I'm writing a small bash script to archive directories off in a compressed format to another location when they are older than a certain age and am having some difficulty. Here's what I'm doing.
#!/bin/bash
# Archives completed CDP episodes to compressed storage. Will eventually expand to put these off-site as well.
InputDir="/home/wgant/stuff/"
OutputDir="/home/wgant/archived/"
find $InputDir$ -maxdepth 0 -mtime +1 -type d -exec echo $OutputDir${} \;
I'm a little green at bash, so I'm taking it slow. For the first step, I just want to dump a list of what the output files would be called. However, when I run the above, the filenames are right, but the full path is clearly being concatenated in, which I don't want. How do I just strip out the filename?
Obviously once this works, I'll put the calls in to create the tarballs and delete the directory in question.