Tagged Questions
2
votes
3answers
57 views
Replace filename with parent folder name
I have a bunch of files each in their own subdirectory. I need to write a script to rename each file to have the same name as its directory: For example, given:
./1111/1234.pdf
./2222/2345.pdf
...
2
votes
4answers
475 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
1answer
327 views
Export a m3u playlist to a directory in order they appear in the playlist
There is a way to rsync a m3u playlist into a destination directory.
How can I process the list and number the output so it orders the files to match the playlist order?
For example the m3u:
...
17
votes
7answers
22k 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 ...