|
|
Posted Dec 03, 2008 at 11:39:34 AM
Subject: bash script for list files
Hello.
I need an script that do a files list, I will explain:
I have a list of include directories "include.txt"
/etc
/home
/var
I have a list of exclude directories "exclude.txt"
/var/apt
/var/cache
I need do with find command list all files included in the directories in "include.txt" file and will exclude all files in the subdirectories of the exclude list to other list, for example "result.txt"
Any help will be appreciated
Kokolisso
|
thobbs
Joined Oct 12, 2008 Posts: 238
Location:Texas!
Other Topics
|
Posted:
Dec 03, 2008 5:22:38 PM
Subject: bash script for list files
You could do it with a one-line [b]find[/b] for each base directory to be search.
To exclude, you can use the [b]-path [i]dir[/i] -prune -o -print[/b] for each [b][i]dir[/i][/b] you want to exclude.
Example:
[code=xml]find /var -path /var/apt -prune -o -print -path /var/cache -prune -o -print[/code]
This would handle the var search. If you want to do it in a script, all you have to do is pull and plug the directories: one find for each base directory and exlude all directories for every find.
|