Sponsored Content
Top Forums Shell Programming and Scripting How to copy files from one location to another based on a priority? Post 302864511 by Chubler_XL on Wednesday 16th of October 2013 04:06:02 PM
Old 10-16-2013
1. Is it a typo that Friday's file is missing the 05 i.e. should abc_def_YYYYMMDD above be abc_def_05_YYYYMMDD

2. if the files are sorted by the YYYYMMDD part of the file name will this do the trick in getting the order right.


Say your filenames are like this:

Code:
221_170_01_20131014
rtn_17_02_20131015
trm_01_03_20131016
xxx_yyy_04_20131017
abc_def_05_20131018

You could try doing something like this:

Code:
LOOK_DIR=/var/spool/dumpdir
PROC_DIR=/var/spool/ready
WAIT=120

ls $LOOK_DIR | sort -t_ -k 4 | while read file
do
    cp "$LOOK_DIR/$file" "$PROC_DIR/$file"
    sleep $WAIT
done

This User Gave Thanks to Chubler_XL For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

copy files from one location to similar location

I need help in forming a script to copy files from one location which has a sub directory structure to another location with similar sub directory structure, say location 1, /home/rick/tmp_files/1-12/00-25/ here 1-12 are the number of sub directories under tmp_files and 00-25 are sub... (1 Reply)
Discussion started by: pharos467
1 Replies

2. Shell Programming and Scripting

Shell Script for Copy files from one location to another location

Create a script that copies files from one specified directory to another specified directory, in the order they were created in the original directory between specified times. Copy the files at a specified interval. (2 Replies)
Discussion started by: allways4u21
2 Replies

3. Shell Programming and Scripting

Copy files in thumbnail folder to a secondary location for Amazon S3

Hello all! I am trying to create a script that will copy files from one location, to another but only folders that are filled with thumbnails to an exact directory replica in the second location. For example: /images/2012/01/19/Event/Photographer/thumbnails to ... (4 Replies)
Discussion started by: Buzzman25
4 Replies

4. UNIX for Dummies Questions & Answers

how to copy files and record original file location?

:EDIT: I think my post name should have been labeled: how to copy files and record original file location. not "retain". Hello, this is my first post! I searched the forums a lot before posting, but was unable to answer my question. Here's my problem: There are several hundred text files... (4 Replies)
Discussion started by: willie8605
4 Replies

5. Shell Programming and Scripting

Copy files from one location to another

I have below files in one location /test/files and also for each dates there are similar files A20130924.0000-0005_file1 A20130924.0000-0005_file2 A20130924.0005-0010_file1 A20130924.0005-0010_file2 . . . A20130924.2355-0000_file1 A20130924.2355-0000_file2 If i execute the script like... (4 Replies)
Discussion started by: Saidul
4 Replies

6. Shell Programming and Scripting

Consolidate files based on priority

please help, I would like to merge 4 files, all of them same format. The first col is the key for all files,followed by variable number of fields so I want to check if the key is present in the files according to priority and then also add a column saying it came from which file . So the... (4 Replies)
Discussion started by: ritakadm
4 Replies

7. Shell Programming and Scripting

How to copy files from one location to another using xargs??

Hello Experts, I need to copy files from one location to another using xargs. Tried something like this (In Ubuntu & Solaris ). mkdir -p 1234; find /home/emd/Desktop/n007/M007/ -type f -name "A2014*" | xargs -0 cp -r {} /home/emd/Desktop/1234 But every time i run this, a weird error... (6 Replies)
Discussion started by: Saidul
6 Replies

8. Shell Programming and Scripting

Use find with cp and sed in ksh to copy files to a slightly different location

Hello there wonderful people, I am running on Solaris 10 and with the following ksh version: strings /bin/ksh | grep Version | tail -2 @(#)Version M-11/16/88i Suppose I want to copy files that end in _v2 from underneath /dir1/dir2/save directory to /dir1/dir2. Basically, what I’m... (12 Replies)
Discussion started by: ejianu
12 Replies

9. Shell Programming and Scripting

Copy files based on specific word in a file name & its extension and putting it in required location

Hello All, Since i'm relatively new in shell script need your guidance. I'm copying files manually based on a specific word in a file name and its extension and then moving it into some destination folder. so if filename contains hyr word and it has .md and .db extension; it will move to TUM/HYR... (13 Replies)
Discussion started by: prajaktaraut
13 Replies

10. UNIX for Beginners Questions & Answers

Copy data at specified location from multiple files

Hello everyone, Im super new to coding but increasingly in need of it at work. Im have task stacked because of this problems, that I cannot figure out how to solve looking on the internet after trying many many things that looked similar to me. I have multiple data files of the form (see below).... (2 Replies)
Discussion started by: Xfiles_fan
2 Replies
EXPIREOVER(8)						      System Manager's Manual						     EXPIREOVER(8)

NAME
expireover - Expire entries from the news overview database SYNOPSIS
expireover [ -a ] [ -D overviewdir ] [ -f file ] [ -n ] [ -O overview.fmt ] [ -s ] [ -v ] [ -z ] [ file... ] DESCRIPTION
Expireover expires entries from the news overview database. It reads a list of pathnames (relative to the spool directory, /var/spool/news), from the specified files or standard input if none are specified. (A file name of ``-'' may be used to specify the stan- dard input.) It then removes any mention of those articles from the appropriate overview database. OPTIONS
-z If the ``-z'' flag is used, then the input is assumed to be sorted such that all entries for a newsgroup appear together so that it can be purged at once. This flag can be useful when used with the sorted output of expire(8)'s ``-z'' flag. -s If the ``-s'' flag is used, then expireover will read the spool directory for all groups mentioned in the active(5) file, and remove the overview entries of any articles that do not appear in the directory. -f To specify an alternate file, use the ``-f'' flag; a name of ``-'' is taken to mean the standard input. -a The ``-a'' flag reads the spool directory and adds any missing overview entries. It will create files if necessary. This can be used to initialize a database, or to sync up a overview database that may be lacking articles due to a crash. Overchan should be running, to ensure that any incoming articles get included. Using this flag implies the ``-s'' flag; the ``-f'' flag may be used to add only a subset of the newsgroups. -v To see a list of the entries that would be added or deleted, use the ``-v'' flag. -n To perform no real updates, use the ``-n'' flag. -D The ``-D'' flag can be used to specify where the databases are stored. The default directory is /var/spool/news/over.view. -O The ``-O'' flag may be used to specify an alternate location for the overview.fmt(5) file; this is normally only useful for debug- ging. HISTORY
Written by Rob Robertson <rob@violet.berkeley.edu> and Rich $alz <rsalz@uunet.uu.net> (with help from Dave Lawrence <tale@uunet.uu.net>) for InterNetNews. This is revision 1.8, dated 1996/10/29. SEE ALSO
expire(8), overview.fmt(5). EXPIREOVER(8)
All times are GMT -4. The time now is 02:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy