Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Add variables together (Beginner)

$
0
0

Hi - I'm trying to write a script that will back up a folder from my DropBox, but adding a date element so that when the script is run again (say the next day....) the file name isn't a duplicate. 

I'm not sure how to create a directory based on the location and the date though.... Perhaps easier to see :

##Script to copy folder from DropBox to Desktop folder

##Make directory variables

$DropBox_location = "C:\Users\USER NAME\Dropbox\OTHER NAME\synced dropbox"
$Back_Up_Location = "C:\Users\USER NAME\Desktop\DropBackUp"

##Create a unique key number based on date & time for each folder name to use. 
$ID_Number = Get-Date -Format s

##create a folder which uses the ID variable. 

$Back_Up_Location_New = $Back_Up_Location && $ID_Number

Its the $Back_Up_Location_New that I'm not really sure about (although I may well be wrong about other elements...)

Hope that's clear.

Thank you. 


Viewing all articles
Browse latest Browse all 21975

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>