mercredi 18 février 2015

Find files in current directory, list differences from list within script


Vote count:

0




I am attempting to find differences for a directory and a list of files located in the bash script, for portability.


For example, search a directory with phpBB installed. Compare recursive directory listing to list of core installation files (excluding themes, uploads, etc). Display additional and missing files.


Thus far, I have attempted using diff, comm, and tr with "argument too long" errors. This is likely due to the lists being a list of files it is attempting to compare the actual files rather than the lists themselves.


The file list in the script looks something like this (But I am willing to format differently):



./file.php
./file2.php
./dir/file.php
./dir/.file2.php


I am attempting to use one of the following to print the list:



find ./ -type f -printf "%P\n"


or



find ./ -type f -print


Then use any command you can think of to compare the results to the list of files inside the script.


The following are difficult to use as there are often 1000's of files to check and each version can change the listings and it is a pain to update a whole script every time there is a new release.



find . ! -wholename './file.php' ! -wholename './file2.php'
find . ! -name './file.php' ! -name './file2.php'
find . ! -path './file.php' ! -path './file2.php'


With the lists being in different orders to accommodate any additional files, it can't be a straight comparison.


I'm just stumped. I greatly appreciate any advice or if I could be pointed in the right direction. Ask away for clarification!



asked 1 min ago







Find files in current directory, list differences from list within script

Aucun commentaire:

Enregistrer un commentaire