Skip to main content

All Questions

Tagged with
1 vote
1 answer
138 views

How to move a set of files and directories, excluding another (sub-)set

I have two bash arrays, one of them (named toMove) contains paths to files and directories to move (not copy) somewhere else, and the other one (named exclude) contains paths to files and directories ...
anick's user avatar
  • 515
1 vote
0 answers
700 views

I have a text file with a list of files I need copied how do I do this?

I have a text file that has a list of files with each file name on a new line. Those files exist in multiple subfolders. I need to copy those files to a separate folder where all of the files that I'm ...
Boiddude's user avatar
1 vote
2 answers
332 views

Finding a string in a txt of house addresses with number ranges by passing in exact number and street names

Context I'm a postal worker (mail sorter) and am trying to write a bash script which allows me to input an exact street address and first couple letters of a street name, and have it return the ...
YMGenesis's user avatar
0 votes
2 answers
4k views

"find: paths must precede expression:" error only when run in a script

If I do my find command at the command line, it works fine, but if I try it in a script, I get this error. I run the command like FILTER=" | grep -v \"test\"" files=`find . -type f ...
Thundercleez's user avatar
0 votes
1 answer
204 views

Looping through all files, skipping some dynamically

rather new to unix. Trying to create a script to loop through all files and subdirectories given a directory and printing them. I would like to be able to skip certain directories dynamically though. ...
m.smith7878's user avatar
1 vote
1 answer
629 views

Find command - file path with white space

I'm trying to use a script that will run through a bunch of different folders and find Indesign files with "16x9" in the file name, and then loop them through a small AppleScript portion of code. I'm ...
Tinysuitcase's user avatar
3 votes
1 answer
2k views

Escaping problem with find command

I need to find everything in a directory, excluding certain subdirectories and files. My script needs to call this as a function: function findStuff() { # define exclusions ignore_dirs=("$1" "*...
lonix's user avatar
  • 1,945
1 vote
3 answers
3k views

find a file through particular search in while loop [closed]

Actually it is related to my previous post sorting out directories by searching certain file extension which is still unanswered. There are many options available to solve the problem, but I am ...
Akand's user avatar
  • 69
8 votes
2 answers
5k views

Manipulate {} return string from find -exec

I want to do it as efficient as possible in case there will be a lot of files. What I want is rename all the files I found and remove their suffix. For example: [/tmp] $ ls -l a.log b.log c.tmp [/...
Nir's user avatar
  • 1,395
6 votes
3 answers
2k views

How do I properly escape weird characters in a bash script?

I am no professional in scripting or find commands what so ever (Just a warning). I am trying to create a script that can move all my mp3 podcasts to a folder that I can then move to my phone. So ...
Jason Smit's user avatar
2 votes
3 answers
2k views

Asking Bash to cd into each directory under some path and run a command when it is inside?

Take this path for example: /var/www/html. Inside the dir html, there are a few subdirectories. I need the system to go into each one of these sub-directories via cd (it must be cd), and then running ...
user avatar
1 vote
1 answer
232 views

error when executing find command using variable

I have written a find command to copy some source files: find ./lib ./tools -type f -regex '.*\.\(cpp\|c\|h\)$' -exec cp --parents \{\} /tmp/potato \; -print This works well, but I also want to add ...
XNor's user avatar
  • 113
0 votes
2 answers
137 views

If filename has more than n characters, delete the last ones

I'm kinda new with the unix shell, and I don't seem to find the answer of my problem : I have a folder containing multiple files : a correct filename contains exactly 13 characters (numbers + letters ...
AdW's user avatar
  • 1
2 votes
1 answer
763 views

Bash script unable to move files

I'm trying to write a "janitor" script that will run as a cron job in one specific directory. It is supposed to create an archive folder with the date of creation in the name, and then find and move ...
Evan's user avatar
  • 23
1 vote
3 answers
4k views

Shell script to find and count total number of characters in all the files

How can I make a script that finds every file in your home directory that is less than 3 days old and then gets a count of the total number of characters in all of these files?
pnizi's user avatar
  • 15

15 30 50 per page