Tagged Questions
1
vote
2answers
229 views
Command to find file/path lengths that are too long for burning to DVD?
I'm trying to burn a DVD from Windows but it fails because the full path name length exceeds the limit of something like 255 characters.
Our files are stored in Debian Linux (accessed by Windows ...
2
votes
3answers
195 views
Manipulate file name piped from find command
I'm relatively new to Bash and am trying to do something that on the surface seemed pretty straightforward - run find over a directory hierarchy to get all of the *.wma files, pipe that output to a ...
2
votes
4answers
433 views
chown all files based on file name pattern in current directory
I'm trying to chown all files whose filenames begin with ChownFileNames. I've used this command, but it doesnt seem to work:
find . -maxdepth 1 |grep 'ChownFileNames*' -exec chown hadoop:hadoop -- {} ...
3
votes
2answers
359 views
How do I find a bunch of files with a string in its filename (or body text) and then move all those files to a specific folder?
Say - what if I wanted to move every HTML file in several independent directories with the word "heavengames" in its filename (and as a second question, every HTML files with the word "heavengames" in ...
7
votes
2answers
815 views
How can you move (or copy) all files to a directory with the same filename prefix?
Using Bash
So let's say I have a bunch of files randomly placed in a parent directory ~/src, I want to grab all the files matching a certain suffix and move (or copy) them to a ~/dist directory.
...
4
votes
3answers
929 views
How store in a variable a file list that includes the backslash when needed?
Main question:
I am writing a script to perform a backup. I make a list of files in the following way:
LISTOFFILES=$(find ~ \( -name '*.[pP][dD][fF]' -o -name '*.[oO][dD][tT]' \))
The variable ...
1
vote
1answer
564 views
Rename All Files with a Certain Name
I'm trying to find certain files with the name "stringx" and replace the name (but not the extension) with "stringy". So basically for stringx.txt and stingx.cs, I'd want stringy.txt and stringy.cs. ...
2
votes
3answers
627 views
create md5 hash from a recursive file listing when some paths have spaces
I need to create an md5 hash of every directory and file inside of one main directory. The only thing that is keeping me from success is figuring out a way around files with a space in the path.
I am ...
4
votes
4answers
286 views
Find files without a number
I am trying to write a simple script that will iterate through all drives except sda. Right now I have this
for i in $(find /dev/ -name "sd*" ! -name "sda*")
do
echo $i
done
However this ...
6
votes
3answers
641 views
Is it possible to nest a 'find -exec' within another 'find -exec'?
Something like the following is what I what I'm after,
but my code doesn't work, no matter how I escape {} and + ;
find ./ -maxdepth 1 -type d -name '.*' -exec \
find {} -maxdepth 1 -type f ...
7
votes
4answers
467 views
How can I find a file whose name includes a given string, such as “abcde”?
Within a set of directories, how do I find a file whose name includes a given string, such as "abcde"?
4
votes
3answers
2k views
How to find files in subdirs and sort them by filename in a single command?
Result of a normal find using find . ! -path "./build*" -name "*.txt":
./tool/001-sub.txt
./tool/000-main.txt
./zo/001-int.txt
./zo/id/002-and.txt
./as/002-mod.txt
and when sorted with sort -n:
...
16
votes
7answers
20k views
Looping through files with spaces in the names?
I wrote the following script to diff the outputs of two directores with all the same files in them as such:
#!/bin/bash
for file in `find . -name "*.csv"`
do
echo "file = $file";
diff ...