Click here to Skip to main content
15,885,435 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I am not so familiar with the linux scripting thing ...and had to do something weird

I have a simple directory which has many folders in YYYYMMDD format... this is how it looks when I do a ls on the directory

[admin@xxx audit]$ ls
1145 20140827 20140828 20140829 20140830 20140831 20140901 20140902 20140903 20140904 20140905 20141020 20141021 20141022 20141023 20141024 20141025 20141026 20141027 20141028 20141029 20141030 20141031 nohup.out

Now what I have to do is copy one folder (in ascending order) to another directory.
I will save this folder name copied somewhere on my disc.

Now I need to copy again the folder which comes after the one which was copied previously and so on.

e.g. I copied first 1145 to the destination and saved it in last_copied_date.txt.
Now in next run I need to read last_copied_date.txt for this folder name and then since 20140827 comes next to 1145, copy it to the destination and replace the name in last_copied_date.txt with this newly copied folder name.

Again in third run 20140828 will be copied (remember 1145 and 20140827 still exists there on source directory) and last_copied_date.txt will be updated.

Any help is appreciated.
Posted
Comments
Richard MacCutchan 27-Feb-15 4:16am    
You have not explained how you are planning to do this. Will you write a program, a shell script, or just do some manual commands?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900