Page 1 of 1

Trouble with simple script to copy/move files after download

Posted: January 26th, 2013, 12:36 am
by Mithrilhall
I'm attempting to write a simple script to copy/move files from my complete directory to my book_collection and I'm not sure what I'm doing. ???


Code: Select all

#!/bin/bash


# ebooks location?
book_collection="/media/f2957688-cb5e-4d5f-af3f-45d43d902197/ebooks" 

# download location?
working_dir="/media/f2957688-cb5e-4d5f-af3f-45d43d902197/nzb/Downloads/complete"

# Mode 'move' or 'copy'
mode="copy"



# Copy or Move epub books to new location...

if [ "$mode" = 'move' ]; then
  mv files with "*.epub" in name to $book_collection
  clean up old files "delete file and directory"
else
  cp files with "*.epub" in name to $book_collection
fi

Re: Trouble with simple script to copy/move files after down

Posted: January 26th, 2013, 2:26 am
by sander
And what platform is this? Unix/linux/OSX?

Why the English pseudo code "mv files with "*.epub" in name to $book_collection" etc?

Did you base the script on an existing script?

Re: Trouble with simple script to copy/move files after down

Posted: January 26th, 2013, 1:31 pm
by Mithrilhall
OS: Linux
I was looking at other scripts and got nowhere.

Re: Trouble with simple script to copy/move files after down

Posted: January 26th, 2013, 2:15 pm
by sander
Pseudo-code won't help much in the real world.

Advice: create category for Books, with a special destination directory. Problem solved. No script needed