Move files to directories based on extension

后端 未结 6 1449
慢半拍i
慢半拍i 2020-12-14 02:06

I am new to Linux. I am trying to write a shell script which will move files to certain folders based on their extension, like for example in my downloads f

6条回答
  •  無奈伤痛
    2020-12-14 02:31

    There is no trigger for when a file is added to a directory. If the file is uploaded via a webpage, you might be able to make the webpage do it.

    You can put a script in crontab to do this, on unix machines (or task schedular in windows). Google crontab for a how-to.

    As for combining your commands, use the following:

    mv *.mp3 *.ogg ../../Music
    

    You can include as many different "globs" (filenames with wildcards) as you like. The last thing should be the target directory.

提交回复
热议问题