Page 1 of 1

help with my script

Posted: January 23rd, 2017, 3:22 pm
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.

Re: help with my script

Posted: January 23rd, 2017, 4:39 pm
by shypike
Make sure the script is executable.
chmod +x name


Also, use single quotes when using wildcards in a find statement.

Re: help with my script

Posted: January 26th, 2017, 6:47 am
by MNMmnm
should i "just" write it in the beginning of the script? Also the file should be .sh right?

Re: help with my script

Posted: January 29th, 2017, 2:00 am
by beardbro
In terminal, you need to run

Code: Select all

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