Visit Our UNIX and Linux User Community


i dont want files which are being uploaded 5 to 10 min ago.


 
Thread Tools Search this Thread
Top Forums UNIX for Advanced & Expert Users i dont want files which are being uploaded 5 to 10 min ago.
# 1  
Old 04-01-2011
i dont want files which are being uploaded 5 to 10 min ago.

i want to move files from A dir to B dir, say eg: mv *memo*.txt /scripts/memo/
but while doing this new files are being uploaded by users, i dont want files which are being uploaded 5 to 10 min ago. other wise even files which are being currently uploaded will get moved to /scripts/memo.
# 2  
Old 04-01-2011
Save a list of the directory just before the copy, then loop through that list.

If your still having trouble, post the script you have tried
# 3  
Old 04-01-2011
in /abc/jrd/
users are continuously uploading files memo*.txt
i have created a memo.sh file in that i have written
cd /abc/jrd/
mv memo*.txt /scripts/memo

while files are being moved to this /scripts/memo users who are uploading new file are not getting fully copied i this path i want that there should be delay for 5 to 10 min of current file transfer and rest file should be move to /scripts/memo
# 4  
Old 04-01-2011
does it work?

Code:
find . -name "memo*.txt" -mmin +10 |xargs -i mv {} /yourTarget/


Last edited by sk1418; 04-01-2011 at 07:25 AM..
# 5  
Old 04-02-2011
i am getting this error in putty
find: bad option -mmin
# 6  
Old 04-02-2011
What if the file is several GB large and it will take more than 10 minutes?
I suggest checking whether the file is being accessed with 'lsof'. Something like this:

Code:
for i in memo*.txt ; do 
  if [ ! -z "`lsof $i`" ] ; then 
     echo "File $i is being accessed. Skipping..." 
  else
    mv $i $target
  fi
done

# 7  
Old 04-03-2011
and these files are not in Gb. i just want that when users are uploading these and when i am moving these files through scripts there should be delay of 10 min or half hour. Kindly help
i got this error
memotest.sh[2]: lsof: not found

Previous Thread | Next Thread
Test Your Knowledge in Computers #322
Difficulty: Easy
HTML stands for Hypertext Markdown Language.
True or False?

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help - To copy and compress files one day ago

Hi dears, Hi All, I'm a new member of this Forum. I have need your help to handle this request. "I want to copy and Compress files not of today but of yesterday only using some script". For example I have the following files under a particular directory in a Solaris machine. ... (7 Replies)
Discussion started by: JackyJohn
7 Replies

2. UNIX for Advanced & Expert Users

i dont want to move files which are being uploaded 5 to 10 min ago

in /abc/jrd/ users are continuously uploading files memo*.txt i have created a memo.sh file in that i have written cd /abc/jrd/ mv memo*.txt /scripts/memo while files are being moved to this /scripts/memo users who are uploading new file are not getting fully copied i this path i want that... (1 Reply)
Discussion started by: rakesh_mumbai
1 Replies

3. Shell Programming and Scripting

i dont want to move files which are being uploaded 5 to 10 min ago

in /abc/jrd/ users are continuously uploading files memo*.txt i have created a memo.sh file in that i have written cd /abc/jrd/ mv memo*.txt /scripts/memo while files are being moved to this /scripts/memo users who are uploading new file are not getting fully copied i this path i want that... (0 Replies)
Discussion started by: rakesh_mumbai
0 Replies

4. UNIX and Linux Applications

PAssword protect uploaded files

Hi, Is it possible to make sure/test that all uploaded files to my FTP will be of .RAR format (that's easy) but also password protected? Thanks (0 Replies)
Discussion started by: saariko
0 Replies

5. UNIX for Dummies Questions & Answers

Search for Files that DONT contain a string

How do I search for files that dont contain a certain string? I am currently trying find ./logs -size +1c -exec grep -l 'Process Complete' {} \; -exec ls -l {} \; > $TOD Which gives me files that are reater han 0 file size and contain the string 'Process complete' but I want files that DONT... (13 Replies)
Discussion started by: tonydsam
13 Replies

6. Shell Programming and Scripting

Get Files from ftp which are uploaded recent week

Hi All, Here is a brief scenario for my requirement .. There is a directory in FTP Server, where would files be uploaded on weekly basic. I need to get those files which are uploaded during this week and not the files which are uploaded the previous week and download them to locale... (1 Reply)
Discussion started by: narramadan
1 Replies

7. Shell Programming and Scripting

Finding files which are modified few mins ago

Hi All, I have a requirement to find out the files which are modified in the last 10 minutes. I tried the find command with -amin and -mmin options, but its not working on my AIX server. Can anyone of you could help me. Thanks in advance for your help. Raju (3 Replies)
Discussion started by: rajus19
3 Replies

8. UNIX for Advanced & Expert Users

automate backing up uploaded files

Hi, We are running FTP Server on UNIX (Solaris 9). Users login and upload (also download) files whenever required. Now, we have to automate the process which makes a copy of every file immediately after it gets uploaded to the FTP server (by any user). I've ruled out rsync,mirror,filesync... (2 Replies)
Discussion started by: prvnrk
2 Replies

9. Shell Programming and Scripting

Need to process files created an hour ago

Hello all, I would like to ask for an advice on how to deal with the following scenario. Every now and then, our ERP system creates an interface text file with the following file format - XORD????.DLD where ???? is a sequence number. We can have 1 or more XORD files created in an hour. ... (9 Replies)
Discussion started by: negixx
9 Replies

10. UNIX for Dummies Questions & Answers

Deleting files created before two days ago

Dear All: I want to build a shell that delete files created two or more days ago ... I think it could be built using a special command with ls or grep, I'd apreciate any help from you guys I have a lot of log files from november, december, january and this tool will help me a lot The files... (3 Replies)
Discussion started by: josecollantes
3 Replies

Featured Tech Videos