Skip to content
View in the app

A better way to browse. Learn more.

Unraid

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Code Help for copying files by (YEAR) to drive

Featured Replies

I have all my files stored like such on my server for Media.

 

Transformers(2007)(1080p)

2012(2009)(720p)

Bolt(2008)(720p)

 

Every once in a while the misses will ask me to load up a portable USB drive so when we travel we can have a copy of our ripped movies for on the go. I literally have pre-ripped every movie we have using HandBrake down to 2Channel 720pish in quality

 Normally I'll erase the portable and whatever the year is I'll simply via windows type in the year for this example it would be (2017) and it will show all the movies from 2017 which are the newest. The problem is I'm getting lazier and somebody will always say why don't we have this or why don't we have that from last year or the year before that. I did this up out of laziness that sorta suits my needs.  

 

To explain the below. First Off I set up a specific location on a Drive so I didn't have to retype if over and over. 

Then I established the current year so when the script sorts through my files its currently looking for all (2018) then it moves to all the (2017) and then on to (2016) on and on for 5 years. I'd like to go farther and farther back, but its a lot of typing. 

 

Then when it finishes the 5 years it erases whatever didn't fit on the drive or any empty folders.  

 

#Grab newest movies based on year and pack drive

#Using Unassigned Devices fill in location
SOURCE=/mnt/disks/General_UDisk
DESTINATION=$SOURCE/Movies/

#Setup Destination Drive
mkdir $SOURCE/Movies/

#This Year
TODAY=$(date +"%Y")
cp -Rn $(ls -dt /mnt/user/Travel/*$TODAY*) $DESTINATION

#Previous Year
LAST1=$(date -d "-1 year" +"%Y")
cp -Rn $(ls -dt /mnt/user/Travel/*$LAST1*) $DESTINATION

#Previous Year
LAST2=$(date -d "-2 year" +"%Y")
cp -Rn $(ls -dt /mnt/user/Travel/*$LAST2*) $DESTINATION

#Previous Year
LAST3=$(date -d "-3 year" +"%Y")
cp -Rn $(ls -dt /mnt/user/Travel/*$LAST3*) $DESTINATION

#Previous Year
LAST4=$(date -d "-4 year" +"%Y")
cp -Rn $(ls -dt /mnt/user/Travel/*$LAST4*) $DESTINATION

#Previous Year
LAST5=$(date -d "-5 year" +"%Y")
cp -Rn $(ls -dt /mnt/user/Travel/*$LAST5*) $DESTINATION

#Find files that appear to not be complete and erase them
find $DESTINATION -type f -size -1000k -delete

#Find empty folders that didn't make it and delete them
find $DESTINATION -type d -empty -delete

 

The reason I'm sorting by year is When the misses says she wants to bring along the newest Movies she doesn't mean the newest to us, but the newest released movies. Meaning just because I Ripped a copy of Star Wars from 1977 yesterday, technically that movie is from 1977 not 2017. 

 

Anyways if anybody has a way to simply this please let me know. My goal is to pack a drive starting at (2018) then working all the way down until its full.  My way is crude, but it only covers 2018-2014 without repeating the same few lines of code over and over all the way down to 1970 or whatever. Of course I don't have enough space to go back that way, but......... :D

 

Those individual copy statements you can simply replace by a loop.

for YEAR in {2018..2014}; do
  cp -Rn $(ls -dt /mnt/user/Travel/*$YEAR*) $DESTINATION
done

 

  • Author
23 hours ago, bonienl said:

Those individual copy statements you can simply replace by a loop.


for YEAR in {2018..2014}; do
  cp -Rn $(ls -dt /mnt/user/Travel/*$YEAR*) $DESTINATION
done

 

 

Lol

 

I'll take a look at that. Seems way easier than my nightmare. 

 

So 2018..2014 basically is going to look through everything that is 2018-2104?

 

I found a site talking about. Thanks for the direction. ;-)

I knew I should of used a loop, but hey I was up late playing with this.

A Windows Solution would be Beyond Compare by Scooter Software. You can select your source files on the left & destination on the right and then filter by year. It also has scripting capabilities. You can optionally hide/ignore movies/years which you don't care about or have already seen.

  • Author

Thanks. I’ll take a look at that as well. 

Archived

This topic is now archived and is closed to further replies.

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.