Solved

need script to copy files in order

Posted on 2002-03-25
2
206 Views
Last Modified: 2010-04-21
I have many files in a directory that are named as follows

QDV_200203191143190276.txt
QDV_200203191143190307.txt
QDV_200203191143190313.txt

Basically having the naming convention

QDV_YYYYMMDDHHMISSmmmm.txt

I need to copy these files one by one to another directory, where they will be read in by another program.  The program reading them in, polls at 1 second intervals, so if I could copy them in at 1.5 or 2 second intervals (preferrably 1.5) to the new directory, that would be great.

Just use directory1/directory2 naming conventions...I can change it to what I need it to be.

Thanks

mboss
0
Comment
Question by:mboss
  • 2
2 Comments
 
LVL 4

Expert Comment

by:newmang
ID: 6895368
What about something like the following

for FILENAME in `ls QD*.txt`
  do
     cp -f dir1/$FILENAME dir2/$FILENAME
     sleep 2
  done
exit

If you want them read in name order then the first line would read

for FILENAME in `ls QD*.txt | sort`

Note the tick marks are backticks....

Cheers - Gavin
0
 
LVL 4

Accepted Solution

by:
newmang earned 300 total points
ID: 6895373
What about something like the following

for FILENAME in `ls QD*.txt`
  do
     cp -f dir1/$FILENAME dir2/$FILENAME
     sleep 2
  done
exit

If you want them read in name order then the first line would read

for FILENAME in `ls QD*.txt | sort`

Note the tick marks are backticks....

Cheers - Gavin
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In tuning file systems on the Solaris Operating System, changing some parameters of a file system usually destroys the data on it. For instance, changing the cache segment block size in the volume of a T3 requires that you delete the existing volu…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

939 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now