Moving files from all subdirectories without the tree structure

Appa, who’s very active on Facebook, recently wanted an easy way to sift through his old videos and photos that were up on his account. I decided to take a dump of his data from the network using the download your information section. I initiated the process with just a few clicks and after a few days, I was able to download the zipped files of all the content he had posted on FB. including the likes, messages, shares etc. If you haven’t already, I would strongly recommend you get a copy of your data. I rarely interact on Facebook these days so it was even more interesting to see all the information they collect on you.

Anyways, once I had the zipped files, I wanted to sift through the folder structure and copy over all the media from it to a specific location. Using a combination of the tree and find commands this was pretty straightforward. Logging them here for later reference:

List files with tree hierarchy:


Find all files within the current directory and nested sub-directories and move them to specific folder:

find . -print -name "*.*" -type f -exec mv -n {} /path/to/destination/directory/ \;

Once I had the files [Totally about 25Gb], I realised I had to move them over to my dad’s machine. Good old Syncthing came to use here to send over the files.

Network auto-latch

I realised the raspberry pi that hosts my nextcloud setup wasn’t quite latching back on to the network if the router was turned off or if the internet was sketchy. Was a pain to hard boot the device manually to reset it. Decided to write a short script to reset the network connection when it noticed something was off.

ping -c4 > /dev/null
if [ $? != 0 ] 
  echo "SOS..Restarting eth0 for network latch"
  /sbin/ifdown 'eth0'
  sleep 5
  /sbin/ifup --force 'eth0'

A chron job runs every 10 minutes to take pulse of the network, runs the above code and picks up connectivity without manual intervention!


As planned a few days back, I rewrote some back-end code to minimize the dependency on the workflow app and better integrate with direct desktop publishing. But for a  few isolated kinks, this should be set. This should now give me more flexibility to post from indie publishing platforms and set the stage for other enhancements.