Please support our Shell Scripting advertiser: Programming Forums
![]() |
•
•
Join Date: Sep 2007
Posts: 1
Reputation:
Rep Power: 0
Solved Threads: 0
hello,
I try to make a script to move files that are not in use or open by another program or process. it is kind of cleanup script. I need to cleanup some log-files that are not in use by the programs.
i know that they are tools to check this files ( lsof and fuser) but I don 't see or find any good (simple) example to move files from one directory to another without the open /used files ?
thanks in advance,
Jonay
I try to make a script to move files that are not in use or open by another program or process. it is kind of cleanup script. I need to cleanup some log-files that are not in use by the programs.
i know that they are tools to check this files ( lsof and fuser) but I don 't see or find any good (simple) example to move files from one directory to another without the open /used files ?
thanks in advance,
Jonay
•
•
•
•
I try to make a script to move files that are not in use or open by another program or process. it is kind of cleanup script. I need to cleanup some log-files that are not in use by the programs.
i know that they are tools to check this files ( lsof and fuser) but I don 't see or find any good (simple) example to move files from one directory to another without the open /used files ?
Adjust *.log for your needs (you may include the path: /your/path/*.log):
for f in *.log;do fuser "$f">/dev/null 2>&1||rm -- "$f";done
Last edited by radoulov : Sep 26th, 2007 at 6:14 am.
![]() |
Similar Threads
Other Threads in the Shell Scripting Forum
- Open In New Window Php (PHP)
- For Pay Shell Script - Zip / FTP / Delete transactional files (Shell Scripting)
- Korn Shell Script for deleting files older than 2 months (Shell Scripting)
- Zip files, move files, delete source (help me please) (Shell Scripting)
- code to use all .htm files in a directory (C)
- help with shell script padding files with spaces (Shell Scripting)
- How to execute .exe file from the perl script (Perl)
- I Cannot Delete, Move, or Rename a File On My PC. (Viruses, Spyware and other Nasties)
- Can't open any programs (Viruses, Spyware and other Nasties)
- Accessing files that are not currently open and running VB macros in them? (Visual Basic 4 / 5 / 6)
Other Threads in the Shell Scripting Forum
- Previous Thread: Help me to get the output for this one..
- Next Thread: Shell Script to CLean up Files
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)





Linear Mode