-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
JAlcocerT
committed
Mar 8, 2025
1 parent
2f7dc44
commit 6305546
Showing
4 changed files
with
104 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
# Define source and destination paths | ||
$source = "C:\Users\j--e-\Desktop\CAM" | ||
$destination = "F:\DCIM\DJI_001" | ||
|
||
# Ensure the destination folder exists | ||
if (!(Test-Path -Path $destination)) { | ||
New-Item -ItemType Directory -Path $destination -Force | ||
} | ||
|
||
# Get all .MP4 files from source | ||
$files = Get-ChildItem -Path $source -Filter "*.MP4" | ||
|
||
# Check if there are files to copy | ||
if ($files.Count -eq 0) { | ||
Write-Host "No MP4 files found in $source." | ||
exit | ||
} | ||
|
||
$totalFiles = $files.Count | ||
$copiedFiles = 0 | ||
$totalBytes = ($files | Measure-Object -Property Length -Sum).Sum | ||
$startTime = Get-Date | ||
|
||
foreach ($file in $files) { | ||
$fileSizeMB = [math]::Round($file.Length / 1MB, 2) | ||
$fileName = $file.Name | ||
$sourcePath = $file.FullName | ||
$destPath = Join-Path -Path $destination -ChildPath $fileName | ||
|
||
$copyStart = Get-Date | ||
Copy-Item -Path $sourcePath -Destination $destPath -Force | ||
$copyEnd = Get-Date | ||
|
||
# Calculate time taken for the copy | ||
$timeTaken = ($copyEnd - $copyStart).TotalSeconds | ||
$speed = if ($timeTaken -gt 0) { [math]::Round($fileSizeMB / $timeTaken, 2) } else { 0 } | ||
|
||
# Update progress | ||
$copiedFiles++ | ||
$percentComplete = ($copiedFiles / $totalFiles) * 100 | ||
|
||
Write-Progress -Activity "Copying MP4 Files" -Status "Processing: $fileName ($copiedFiles of $totalFiles)" -PercentComplete $percentComplete | ||
Write-Host "Copied: $fileName - Size: ${fileSizeMB}MB - Speed: ${speed} MB/s" | ||
} | ||
|
||
$endTime = Get-Date | ||
$totalTime = ($endTime - $startTime).TotalSeconds | ||
$avgSpeed = if ($totalTime -gt 0) { [math]::Round(($totalBytes / 1MB) / $totalTime, 2) } else { 0 } | ||
|
||
Write-Host "`n✅ Transfer complete!" | ||
Write-Host "Total Files: $totalFiles" | ||
Write-Host "Total Size: $([math]::Round($totalBytes / 1MB, 2)) MB" | ||
Write-Host "Total Time: $([math]::Round($totalTime, 2)) seconds" | ||
Write-Host "Average Speed: ${avgSpeed} MB/s" | ||
|
||
|
||
# # Define source and destination paths | ||
# $source = "C:\Users\j--e-\Desktop\CAM" | ||
# $destination = "F:\DCIM\DJI_001" | ||
|
||
# # Ensure the destination folder exists | ||
# if (!(Test-Path -Path $destination)) { | ||
# New-Item -ItemType Directory -Path $destination -Force | ||
# } | ||
|
||
# # Copy only .MP4 files from source to destination | ||
# Get-ChildItem -Path $source -Filter "*.MP4" | ForEach-Object { | ||
# Copy-Item -Path $_.FullName -Destination $destination -Force | ||
# } | ||
|
||
# Write-Host "MP4 files copied successfully!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
$camFolderPath = Join-Path -Path "C:\Users\j--e-\Desktop" -ChildPath "CAM" | ||
|
||
if (Test-Path -Path $camFolderPath -PathType Container) { | ||
Set-Location -Path $camFolderPath | ||
|
||
Get-ChildItem -Filter "*.MP4" | ForEach-Object { "file '$($_.Name)'" } | Set-Content file_list.txt | ||
|
||
Write-Host "File list generated in: $($camFolderPath)\file_list.txt" | ||
} else { | ||
Write-Warning "CAM folder not found at: $($camFolderPath)" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters