Linked Questions

240 votes
9 answers
328k views

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 $...
Amir Afghani's user avatar
  • 7,373
4 votes
2 answers
3k views

Ubuntu 16.04 #!/bin/bash site="hello" wDir="/home/websites/${site}/httpdocs/" for file in $(find "${wDir}" -name "*.css") do echo "$file"; done exit 0; shellcheck warns me even if I define the ...
Vituvo's user avatar
  • 411
3 votes
1 answer
2k views

I am trying to recursively convert all .mkv files in a folder structure with subfolders to .mp4. I got a standard line that works in just the present folder for video in *.mkv; do ffmpeg -i "$...
Dr_Bunsen's user avatar
  • 145
3 votes
2 answers
2k views

The following link recommends against using loops in shells. bash variables in for loop range Why is this? Here is an example loop I just happened to be looking at when I came across that answer: ...
Zombo's user avatar
  • 1
2 votes
3 answers
420 views

Currently, I am trying to parse out all the files inside a directory. I have a find function, but it appears to not be able to parse in file directories with whitespaces into a loop. Here, "$DIR" is ...
user321627's user avatar
1 vote
3 answers
678 views

I would like to copy many files with the below command. cp `find /Volumes/DATA/ -name "*.app" -depth 1 2> /dev/null` /Volumes/VMWare/img/ But that doesn't work because if it finds a space then it ...
The33Coder's user avatar
1 vote
2 answers
561 views

If I want to find any files with .txt in the name, and for every match that is found copy it into the /junk folder, I understand I could use the following: find / -name ".txt" -exec cp {} /junk \; ...
microscope's user avatar
0 votes
1 answer
773 views

I want to list the size of directories under a given root (using du -hs) . The issue is that where the directory names have spaces the du command is getting each word of the name as a whole directory ...
Stephen Boston's user avatar
1 vote
3 answers
139 views

for X in $(find ~/Documents/ -type f);do date -r "${X}";done The above line works fine when the filenames in "/Documents/" contain no space. However, if the filenames contain a ...
Matthew Wai's user avatar
0 votes
0 answers
802 views

I have a music library that I am trying to restore from backup. The original source library was on a QNAP NAS and I copied it over to a CentOS system without any problems. Now that I am trying to copy ...
alpha754293's user avatar
0 votes
1 answer
130 views

I'm trying to run join a bunch of files using the find command. I have determined that filenames containing spaces are giving me a problem. The following comand works for files that do not contain ...
speld_rwong's user avatar
1 vote
1 answer
95 views

I have a file test.txt which contains file names like below where some file names will have spaces and some will not. Mon - Tue corrected item.csv Sat -Sun incorrect item.csv Wed_THU_corrected_item....
deepak's user avatar
  • 21
0 votes
0 answers
104 views

How can the script below be made to always work no matter the filenames returned by find ? #!/bin/sh cmds_should_always_work() { echo "\n\n*********************************" $1 stat --...
TrevTheDev's user avatar
0 votes
1 answer
74 views

I have the below folder structure in Linux env: |-- Fixed_Zip | |-- ipython_notebooks | | |-- notebook editor for compute_0anXhGEj.ipynb | | |-- notebook editor for compute_aucScores.ipynb | ...
arielma's user avatar
  • 243
0 votes
0 answers
19 views

I'm trying to loop through each files from current directory and subdirectories. But the problem is file names with blank-space are getting treated as separate files. How do I prevent that. I want to ...
user avatar

15 30 50 per page
1
2 3 4 5
18