Author Topic: Software to copy folders based on day of week  (Read 1897 times)

Offline talmid chuchem

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Oct 2014
  • Posts: 1130
  • Total likes: 68
  • DansDeals.com Hat Tips 5
    • View Profile
Software to copy folders based on day of week
« on: December 24, 2018, 02:59:02 AM »
I have a custom built machine with a camera connected to it. All recording of Sunday go in a folder named sunday, Monday goes in Monday etc.
But after a few days all files in the Sunday folder get deleted to make space for recordings of the coming sunday, then goes Monday.....

So my question is, if there is a program that I can set that every Monday it should copy the Sunday folder to a different location, & rename it with the date, & Tuesday it should copy the Monday folder.... so the recordings shouldn't get lost.

TIA

Offline yoshyosh

  • Dansdeals Platinum Elite + Lifetime Gold Elite
  • ******
  • Join Date: Aug 2012
  • Posts: 972
  • Total likes: 137
  • DansDeals.com Hat Tips 147
    • View Profile
Re: Software to copy folders based on day of week
« Reply #1 on: December 24, 2018, 09:45:13 AM »
You can use Windows backup to copy files from a specific location and not include duplicates, you can also set 7 backups to run at sometime before each is deleted and save it to a external HDD ect.

Offline Yisroel Tech

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Dec 2015
  • Posts: 2162
  • Total likes: 365
  • DansDeals.com Hat Tips 2
  • Gender: Male
    • View Profile
  • Location: Monsey, NY
Re: Software to copy folders based on day of week
« Reply #2 on: December 25, 2018, 11:12:47 PM »
I cannot think of a software or a simple way for it...

But if something messy is good for you...you can create 7 .bat files with a script like the one below:
Code: [Select]
set /a day=%date:~7,2% - 1
ren "C:\Users\Username\Cam\Sunday" %date:~10,4%-%day%-%date:~4,2%
move "C:\Users\Username\Cam\%date:~10,4%-%day%-%date:~4,2%" "C:\Users\Username\Cam\Archive"
For each of the 7 change the name of the initial folder for another day of the week, and of course the paths you need to adapt to your situation.

Then set of 7 Scheduled tasks each running weekly on one day with the batch file of the day before...

Got it?...

Offline shulem92

  • Dansdeals Presidential Platinum Elite
  • ********
  • Join Date: Feb 2015
  • Posts: 2972
  • Total likes: 136
  • DansDeals.com Hat Tips 1
    • View Profile
  • Location: Lakewood
Re: Software to copy folders based on day of week
« Reply #3 on: December 25, 2018, 11:15:55 PM »
I have a custom built machine with a camera connected to it. All recording of Sunday go in a folder named sunday, Monday goes in Monday etc.
But after a few days all files in the Sunday folder get deleted to make space for recordings of the coming sunday, then goes Monday.....

So my question is, if there is a program that I can set that every Monday it should copy the Sunday folder to a different location, & rename it with the date, & Tuesday it should copy the Monday folder.... so the recordings shouldn't get lost.

TIA
are you able to get into the original software? and instead of saving sunday, monday tuesday, save sunday 12.23.18 monday 12.24.18 tuesday 12.25.18

Offline Yisroel Tech

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Dec 2015
  • Posts: 2162
  • Total likes: 365
  • DansDeals.com Hat Tips 2
  • Gender: Male
    • View Profile
  • Location: Monsey, NY
Re: Software to copy folders based on day of week
« Reply #4 on: December 25, 2018, 11:22:11 PM »
Actually, you can just do the weekday part automatically... so schedule the following once daily:
Code: [Select]
SET MYDATE=%DATE:~0,3%
IF %MYDATE% == Sun SET YESTERDAYDATE=Saturday
IF %MYDATE% == Mon SET YESTERDAYDATE=Sunday
IF %MYDATE% == Tue SET YESTERDAYDATE=Monday
IF %MYDATE% == Wed SET YESTERDAYDATE=Tuesday
IF %MYDATE% == Thu SET YESTERDAYDATE=Wednesday
IF %MYDATE% == Fri SET YESTERDAYDATE=Thursday
IF %MYDATE% == Sat SET YESTERDAYDATE=Friday
set /a day=%date:~7,2% - 1
ren "C:\Users\Username\Cam\%YESTERDAYDATE%" %date:~10,4%-%day%-%date:~4,2%
move "C:\Users\Username\Cam\%date:~10,4%-%day%-%date:~4,2%" "C:\Username\Cam\Desktop\Archive"

Offline talmid chuchem

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Oct 2014
  • Posts: 1130
  • Total likes: 68
  • DansDeals.com Hat Tips 5
    • View Profile
Re: Software to copy folders based on day of week
« Reply #5 on: December 26, 2018, 12:35:03 AM »
are you able to get into the original software? and instead of saving sunday, monday tuesday, save sunday 12.23.18 monday 12.24.18 tuesday 12.25.18
No

Offline talmid chuchem

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Oct 2014
  • Posts: 1130
  • Total likes: 68
  • DansDeals.com Hat Tips 5
    • View Profile
Re: Software to copy folders based on day of week
« Reply #6 on: December 26, 2018, 12:41:02 AM »
Actually, you can just do the weekday part automatically... so schedule the following once daily:
Code: [Select]
SET MYDATE=%DATE:~0,3%
IF %MYDATE% == Sun SET YESTERDAYDATE=Saturday
IF %MYDATE% == Mon SET YESTERDAYDATE=Sunday
IF %MYDATE% == Tue SET YESTERDAYDATE=Monday
IF %MYDATE% == Wed SET YESTERDAYDATE=Tuesday
IF %MYDATE% == Thu SET YESTERDAYDATE=Wednesday
IF %MYDATE% == Fri SET YESTERDAYDATE=Thursday
IF %MYDATE% == Sat SET YESTERDAYDATE=Friday
set /a day=%date:~7,2% - 1
ren "C:\Users\Username\Cam\%YESTERDAYDATE%" %date:~10,4%-%day%-%date:~4,2%
move "C:\Users\Username\Cam\%date:~10,4%-%day%-%date:~4,2%" "C:\Username\Cam\Desktop\Archive"
Where & how do I amount it to run daily automatically?
Thanks

Offline Yisroel Tech

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Dec 2015
  • Posts: 2162
  • Total likes: 365
  • DansDeals.com Hat Tips 2
  • Gender: Male
    • View Profile
  • Location: Monsey, NY
Re: Software to copy folders based on day of week
« Reply #7 on: December 26, 2018, 08:55:40 AM »
Where & how do I amount it to run daily automatically?
Thanks
Open the Task Scheduler and create a new task. It should e pretty simple.

Offline talmid chuchem

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Oct 2014
  • Posts: 1130
  • Total likes: 68
  • DansDeals.com Hat Tips 5
    • View Profile
Re: Software to copy folders based on day of week
« Reply #8 on: December 26, 2018, 11:27:14 AM »
Open the Task Scheduler and create a new task. It should e pretty simple.
do i put it in a notepad & select it to run as the task action?

Offline Yisroel Tech

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Dec 2015
  • Posts: 2162
  • Total likes: 365
  • DansDeals.com Hat Tips 2
  • Gender: Male
    • View Profile
  • Location: Monsey, NY
Re: Software to copy folders based on day of week
« Reply #9 on: December 26, 2018, 01:55:05 PM »
do i put it in a notepad & select it to run as the task action?
Put the script (make sure to change the folder locations) in Notepad and save it as a file the .bat file extension. Then select this script file to run in the Task Schedule.

Offline talmid chuchem

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Oct 2014
  • Posts: 1130
  • Total likes: 68
  • DansDeals.com Hat Tips 5
    • View Profile
Re: Software to copy folders based on day of week
« Reply #10 on: December 27, 2018, 12:00:32 AM »
Put the script (make sure to change the folder locations) in Notepad and save it as a file the .bat file extension. Then select this script file to run in the Task Schedule.
the rename part works perfectly, just the move doesn't seem to work.
I don't know if it makes a difference, but the custom machine is on a network, & i'm trying to copy it to a different PC on the network.
thanks

Offline Yisroel Tech

  • Dansdeals Lifetime Platinum Elite
  • *******
  • Join Date: Dec 2015
  • Posts: 2162
  • Total likes: 365
  • DansDeals.com Hat Tips 2
  • Gender: Male
    • View Profile
  • Location: Monsey, NY
Re: Software to copy folders based on day of week
« Reply #11 on: December 27, 2018, 12:47:07 AM »
the rename part works perfectly, just the move doesn't seem to work.
I don't know if it makes a difference, but the custom machine is on a network, & i'm trying to copy it to a different PC on the network.
thanks
It is hard for me to tell you how to put the folder paths without seeing the actual folder structure.

First, for a test try making the destination local and see if the Move (it is not Copy, it is Move) works.

The network location is mapped as a drive? Try to map it as a drive and make the destination to that drive and see if it works.