0

I have been backing up files from a CCTV camera to an FTP directory without really thinking about it for about 6 months, and inadvertently created a directory with what might be 100,000 files in it.

This week I've decided to do something about it, as now whenever I run the backup script it stalls for 30 minutes while it downloads the filelist needed for the mirror operation.

My first action was to create a small script to use ls to echo all of the filenames in that directory to a file. I then ran that file through google sheets to extract sub-portions of the file name from which to create more managable sub-folders. When I then made the test script below to move the first file I get mv: Access failed: 501 File not found (ARC20170315113818.mp4):

#!/bin/bash

# @description: attempt to move file to new folder

#FTP login details
HOST=####
USER=####
PASSWORD=####

lftp -u "$USER","$PASSWORD" $HOST << EOF


cd /CCTVArchive/V2/192.168.0.24/webdav/sdcard/alarm

mv ARC20170314180647.mp4 2017/03/14/



bye

EOF

Is there a reason why ls and mv would have a different opinion on what files exist?

Thanks

1 Answer 1

0

The error message related to the target directory for the move not existing! Once I've prefaced the mv commands with the appropriate number of mkdir commands they all work as expected.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .