Solved

need script to copy files in order

Posted on 2002-03-25
2
205 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

762 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

21 Experts available now in Live!

Get 1:1 Help Now