← Back to Blog

FTP upload the footages to NAS

FTP upload the footages to NAS Objective > Automate the video production workflow Key Results > Backup footages to nas Key Results > one press push the footages Key Result > Auto upload to Google Drive ( Synology Cloud backup ) Options 1> Do it with powershell Opti

FTP upload the footages to NAS

Objective > Automate the video production workflow

Key Results > Backup footages to nas

Key Results > one press push the footages

Key Result > Auto upload to Google Drive ( Synology Cloud backup )

Options 1> Do it with powershell

Options 2 > Do iut with synology client who has the automation and the backup

ftp upload the 1

Sync can push it but not implement a business rule to send it to the todays folder

ftp upload the 2

Can my rules change or do they matter ?

Why cant i put it a one folder 2023 ? too many files in one folder

maybe i can have filter and rules in there ?

ftp upload the 3

Mine is a backup task

ftp upload the 4

Also putting in the machine name as well

ftp upload the 5

Basic rules

ftp upload the 6

https://www.techpout.com/best-file-copy-utility-software/

All similar tools can not land the files properly

What can my script do >

Copy yesterday > to the folder

Copy today > to the folder

Copy month > to multi folders

Lets try with copy today > 9:24 start time

ftp upload the 7

Go to Folder

`PS C:\Windows\system32> cd "C:\Users\Pexabo\Videos\"
PS C:\Users\Pexabo\Videos>

Google 10 tabs
`

MVP send one file

ftp upload the 8

AI

ftp upload the 9

To copy a file over FTP using PowerShell, you can utilize the built-in FTP functionalities in PowerShell. First, you need to establish an FTP connection by using the New-Object cmdlet to create an instance of the System.Net.WebClient class. Once you have established the FTP connection, you can use the DownloadFile method to download the file from the FTP server to your local machine. Alternatively, you can use the UploadFile method to upload a file from your local machine to the FTP server. Additionally, you can set up a script to automate the process of copying files over FTP, which can save you time and effort in the long run.

ftp upload the 10

Basic test

ftp upload the 11

ftp upload the 12

ftp upload the 13

file name has to be correct with folder

ftp upload the 14

removed voluem 5 it did not work

ftp upload the 15

Longer sequence

ftp upload the 16

ftp upload the 17

Notion rewrite copy clone

ftp upload the 18

file name is the issue

ftp upload the 19

Check errros

ftp upload the 20

No relative paths

ftp upload the 21

25 minutes

ftp upload the 22

Next iteration find all files with a name filter belongss yesterday

Make something working

ftp upload the 23

Set the pattern

ftp upload the 24

Find yesterday

ftp upload the 25

Find mp4

ftp upload the 26

Get full path

ftp upload the 27

Remove mkv > they are just for obs

ftp upload the 28

ftp upload the 29

Create a loop to trigger your code

Assign to a list

ftp upload the 30

Test foreach

ftp upload the 31

ftp upload the 32

Open vs code and put it to a file

VSCode and mp4sa not bad

ftp upload the 33

Plays them slowly and the audio is an issue

ftp upload the 34

Create the file

ftp upload the 35

Scripting extensions

ftp upload the 36

Rename to push to the top

ftp upload the 37

Debug and see the property

ftp upload the 38

Resolve path issues

ftp upload the 39

morefilename errors

ftp upload the 40

test different variations

ftp upload the 41

Semblance/Semblance

upload from fritst principles and check

ftp upload the 42

ftp upload the 43

Provided file name was the problem >> so maybe be the ftp system needs to create the file names...

ftp upload the 44

Backup your code

Google drive for full text search anbd security

ftp upload the 45

Refactor add the days from the hard coded variable

ftp upload the 46

Test yesterday multiple times

ftp upload the 47

Collect config on the top

ftp upload the 48

Yesterday

(Get-Date).AddDays(-1).ToString('yyyy-MM-dd')

days go back and try

ftp upload the 49

Zoom meeting or obs is fine ?

ftp upload the 50

End Result Code

Write-Host "Process Started for daily recordings"

cd "C:\Users\Pexabo\Videos"

$myDaysGoBack = 2

$myday = (Get-Date).AddDays(-$myDaysGoBack).ToString('dd')

$mymonth = (Get-Date).AddDays(-$myDaysGoBack).ToString('MM')

$myyear = (Get-Date).AddDays(-$myDaysGoBack).ToString('yyyy')

$myserverip = "xxx"

$myserverusername = "xxx"

$myserverpassword = "xxx"

$yesterday = (get-ChildItem "C:\Users\Pexabo\Videos\" -recurse -exclude .mkv | where {$_.name -like "$myyear-$mymonth-$myday*"})

Write-Host "Yesterdays recordings"

$yesterday

if($yesterday -eq $Null)

{

Write-Host "No videos yesterday"

}

foreach($myfile in $yesterday)

{

Write-Host "-----------------------------------------"
                
                $myfilepath = $myfile.FullName
                
                Write-Host $myfile.FullName " to be processed"
                
                $myfilepathshort = $myfile.Name
                
                $myfilepathshort =  $myfilepathshort.Replace(" ","_").Trim().Replace("-","_")
                
                $ftp = "ftp://$myserverusername`:$myserverpassword@$myserverip/CreativeRepository/VideoClips/$myyear/$mymonth/($myday)/$myfilepathshort";
                
                Write-Host -Object "ftp url: $ftp";
                
                $webclient = New-Object -TypeName System.Net.WebClient;
                
                $uri = New-Object -TypeName System.Uri -ArgumentList $ftp;
                
                Write-Host -Object "Uploading file path $myfilepath...";
                
                Write-Host -Object "Uploading uri ";
                
                $uri
                
                $webclient.UploadFile($uri, $myfilepath);
                
                Write-Host -Object "Uploaded $myfilepath...";
                
                Write-Host "Synology cloud will upload this from the NAS to the cloud"
                
                Write-Host "-----------------------------------------"
                

}

Write-Host "Process Ended for daily recordings"

Next phase use it 2 hour is gone test it with yesterday and think on the other use cases

ftp upload the 51

ftp upload the 52

ftp upload the 53

this is an async process here is a sample video

Link Word Press

https://drive.google.com/file/d/1MNcQnIL3AnvmA-7ecL2wggAgzohOKGIE/view?usp=sharing

Embed

https://drive.google.com/file/d/1MNcQnIL3AnvmA-7ecL2wggAgzohOKGIE/view?usp=sharing

Custom html

ftp upload the 54

Second embed try

[googleapps domain="drive" dir="file/d/1MNcQnIL3AnvmA-7ecL2wggAgzohOKGIE/preview" query="" width="640" height="480" /]

ftp upload the 55

ftp upload the 56

Google Drive embed fails at public view

ftp upload the 57

ftp upload the 58

https://support.google.com/blogger/thread/73184958/embed-google-drive-video-not-working?hl=en

When i wanna send the footage during the day than it is zero

ftp upload the 59

And there is going to be an overwrite problem

still every update bring a new problem

destinonation folders has to be renamed

ftp upload the 60

Fix the folder with one readme inside

ftp upload the 61

Noce to haves

I need upload count

ftp upload the 62

References

ftp upload the 63

https://www.howtogeek.com/devops/how-to-upload-files-over-ftp-with-powershell/

https://www.synology.com/en-global/dsm/feature/presto

https://stackoverflow.com/questions/19207991/how-to-exclude-list-of-items-from-get-childitem-result-in-powershell


Imported from rifaterdemsahin.com · 2023