help with my script

Come up with a useful post-processing script? Share it here!
Post Reply
MNMmnm
Newbie
Newbie
Posts: 2
Joined: January 23rd, 2017, 3:07 pm

help with my script

Post by MNMmnm »

Hi gents.

I've never tried making a script in Bash before. So I could use some help.

I've made this script. The generel idea is to delete all files in the folder smaller than 200MB, then all files not mp4. The move the rest of the files to a folder called done. Afterwards I wan't to delete the old folder (part not done yet). But already now SAB says that it can not run this script. What am I missing? I assume it know that the complete folder is the main (default) folder.

#!/bin/bash
find . -name "*.*" -size -200MB - delete
find . -type f ! -name "*.mp4" - delete
mv "*.mp4" done/

all help and ideas are welcome.
User avatar
shypike
Administrator
Administrator
Posts: 19774
Joined: January 18th, 2008, 12:49 pm

Re: help with my script

Post by shypike »

Make sure the script is executable.
chmod +x name


Also, use single quotes when using wildcards in a find statement.
MNMmnm
Newbie
Newbie
Posts: 2
Joined: January 23rd, 2017, 3:07 pm

Re: help with my script

Post by MNMmnm »

should i "just" write it in the beginning of the script? Also the file should be .sh right?
beardbro
Newbie
Newbie
Posts: 2
Joined: January 27th, 2017, 12:06 pm

Re: help with my script

Post by beardbro »

In terminal, you need to run

Code: Select all

chmod +x /path/to/your/script
Makes the script executable.
Post Reply