Find Files In A List with known Partial Directories
First I'm new to Linux and have used the find command pretty often but this is where I've hit a snag. I have a file that contains 3500 files that I want to find and then eventually copy to my own directory (these files are all on a shared directory at work atm).
Our work computer are huge and contain large amounts of files and because they are all under numerous directories and sub-directories I wanted to somehow give a loop to make it faster for find to look within the directory I know the file is in (but not necessary which sub-directory). Does that make sense?
The find command is still probably the one you are after. How much information do you know about your targets, or do you just have a list of file names?
Can you tell us which version of Linux you have:-
Differences exist in the various suppliers and versions of Unix (or Linux) so it's important to know what features are available to you so you can get good advice on exploiting them.
At the worst, you could even do:-
.... but there are probably smarters ways available.
With 3500 files: listfile is likely to contain some filenames that are subsets of other filenames and could easily have filenames that could appear as a subset of a directory name rather than being the entire name of the final component of a pathname (so the grep could yield false positives).
If the intent is to eventually copy 3500 files from one directory hierarchy to another directory, we also need to know if you intend to put all of those files in a single directory, duplicate the directory structure of the source hierarchy in the destination hierarchy, or create some other directory structure in the destination. (Putting 3500 regular files in a single directory is usually not a good idea.) You could modify listfile to use BREs to look for a / followed by the name and anchor to the end of a line, but if any of your filenames contain BRE special characters (such as period, asterisk,question mark, etc.), you'll have other problems
A simple awk script can read the output of find, match the file names in your list of files against the final component of the pathnames find listed, and print the source pathnames; but I'd need to know more about what destination file hierarchy you want to create before I'd suggest a solution for this project.
Find all files in the current directory only excluding hidden directories and files.
For the below command, though it's not deleting hidden files.. it is traversing through the hidden directories and listing normal which should be avoided.
`find . \( ! -name ".*" -prune \) -mtime +${n_days}... (7 Replies)
Can anyone come up with a unix command that lists
all the files, directories and sub-directories in the current directory
except a folder called log.?
Thank you in advance. (7 Replies)
Hello, can you please help me writing a command that would output the biggest files on my system from biggest to smallest? I want this to print only the files, not the directories.
I have tried
du -a ~ | sort -nr | head -10
However, this also prints out all the directories - which I do... (8 Replies)
Hi
I'm logged in to an AIX box now and we need to do an audit on this box.
cbssapr01:# pwd
/
Which command will show all the files and directories owned by root user with permissions as 777 ? (8 Replies)
I want to search a server beginning at /home and list directories with more than X files
I found a hack that injects tons of files into a directory
How can I search the server recursively and list directories with more than X files?
Thank you!
like,
find /home (directories, that meet the... (5 Replies)
Hi,
I try to list all files in a folder, including all the subdirs (and their subdirs) and all files contained in each of these folders. I then print it to a simple txt file.
I use ls -R -1 >test.txt
This sort of does what I need, yet, the result is something like:
It reasonably comes... (53 Replies)
Hi,
Please help me, how to get all the direcotries, its sub directories and its sub directories recursively, need to exclude all the files in the process.
I wanted to disply using a unix command all the directories recursively excluding files.
I tried 'ls -FR' but that display files as... (3 Replies)
Hi
I am looking for the correct syntax to find all files in the current directory without listing sub-directoris. I was using the following command, but it still returns subdirectoris and files inside them:
$ ls -laR | grep -v ^./
Any idea? Thanks
PS I am in ksh88 (4 Replies)
I want to count how many levels there are under a directory. I repeat level.
Also how i count only all the files in a directoy ( all files of all directories of all leves down!)
and how can i count only all the directories under a directory (including subdirectories, all levels down)
... (2 Replies)
Hello,
We have in a file a list of the path of files from one server.
We want to search if these files exist on another server , but the path on this new server isn't the same.
We want to use the command "awk" but there isn't the god way.
Example:
on server 1 in a file : listServer1.txt... (4 Replies)