Solved

need script to copy files in order

Posted on 2002-03-25
2
210 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
I have been running these systems for a few years now and I am just very happy with them.   I just wanted to share the manual that I have created for upgrades and other things.  Oooh yes! FreeBSD makes me happy (as a server), no maintenance and I al…
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…
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

688 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