the mv command to place the file in /foundfiles/ directory
the ln command to create a symlink in /foundfiles/ back to the original file.
Example:
change :
The mv command assumes the /foundfiles/ directory and the source directory are on the same filesystem.
Also your cp command assumes files all exist - with all of those variables
I think that, with all those * metacharacters and so on, you may be matching many many files. Decreased I/O is a big win for performance. Assuming all 10000 or so of those possible patterns match.
You seem to be assuming that all those files with all possible value combinations exist. Should that not be the case, running cp for each and ignoring the error message is a huge waste of resources. And, although it will most probably be cached/buffered by the system, you are reading list1 about a hundred times. How about
- reading list1 and list2 once into memory
- running cp only for existing files?
Try
Please adapt the match regex to your needs!
---------- Post updated at 22:59 ---------- Previous update was at 22:50 ----------
You could further improve performance by excluding unapt files with a pattern to ls. And, you could break out of the loops when a file was found.
Just for my own sanity, could you please try the following with your data and let me know how the runtime compares to your script? I get the feeling it should be faster, but maybe all of the processing time is being spent copying files and the time used determining which files to copy doesn't matter...
This User Gave Thanks to Don Cragun For This Post:
Hi, everyone
I have a group lists like this (more lines are omitted:
a b c d
E F G H
....
I want to generate all combinations of two elements in each group line. What I expected is this:
a b
a c
a d
b c
b d
c d
E F
E G
E H
F G
F H
G H (8 Replies)
If there are 100 files created in a directory /data/ today from 2:00 AM to 10:00 AM
I need to move files older than 3:00 AM to a new directory /hold/
How to do that?
Also, if I have to move files between 3:00 AM to 9:00 AM, how to achieve that (3 Replies)
I have a directory e2e_ms_xfer/cent01
this contains the multiple files some of which will be named below with unique date time stamps
e2e_ms_edd_nom_CCYYMMDD_HHMM.csv
What I want to do is in a loop
1) Get the oldest file
2) Rename
3) Move it up one level from e2e_ms_xfer/cent01 to... (1 Reply)
Hi,
I'm trying to improve my Unix skills and I'm wondering what is the best way to move some files based on filetype and attributes like time created?
For instance, lets suppose I have a directory with many different files in it and I'd like to move all the jpgs that were created between May... (6 Replies)
Hi
I have to move files between file systems but files in new file system must have the same attributes as in old one (privileges, time stamp etc).
Which tool is best :
- ufsdump / ufsrestore
- tar
- cpio
- pax
- dd
- mv
Or maybe there is sth else, you suggest to use.
Thx for help (5 Replies)
File_A contains Strings:
a
b
c
d
File_B contains Strings:
a
c
z
Need to have script written in either sh or ksh. Derive resultant files (File_New_A and File_New_B) from lists File_A and File_B where string elements in File_New_A and File_New_B are listed below.
Resultant... (7 Replies)
I'm a novice at unix and need it more and more to do my work.
I seem running into problems getting this script "attempt" to work:
I need to copy all files in a directory, which is containing 22000 files, into a directory one level up. There a tool monitors the content of the dir and processes... (2 Replies)
Hi Friends,
I want a shell script which will move certain .jar files from a specified location (say /publish/content) to (/publish/archive) on every saturday morning 6 am.
One more thing to add is that before moving files it must check free space at (/publish/archive), if it is more than 60 %... (7 Replies)
Hi All,
I have tried so many command but none work like i wanted.
I would like archive which i assume it will move the files and archive it somewhere.
for example:
if i have a folder and files:
/home/blah/test
/home/blah/hello
/home/blah/foo/bar
i would like to archive folder... (6 Replies)