Copy file with .bat?
I want to copy all new files with the name 1234 from different folders to another folder, but I don't want to copy already copied files a second time (even if they have been deleted from the target folder)
I want to copy all new files with the name 1234 from different folders to another folder, but I don't want to copy already copied files a second time (even if they have been deleted from the target folder)
https://www.amazon.de/Kingston-NVMe-Interne-2280-SNV3S-1000G/dp/B0DBR3DZWG/ref=mp_s_a_1_4?crid=1N7E0Z5K3V2C0&dib=eyJ2I joiMSJ9.xTcvo_b-R24gfp_s-4baphjtdauVSvFGe1dxqKUgoREKYZkrzzE-04PQVgAy7h3_YdGE07y7lpeCLCEPfq3fCul0putk8jxOQtpT59-eUFlnap z7FzfWIarrLBqzYFgL8okBWL0-O3dPpPnNCYzmtmx07vNq419Qh6l2SclJIUjOgSIHuq-wveL42hOgxRQ-D_g-1FdOAqKtnKQncldRsA.YfO13BriCo_Zk Fo_YqQ9MhF05CsuYB08q6YdKhScgt4&dib_tag=se&keywords=nvme+ssd+m.2+1tb&qid=1731494096&sprefix=nvme+ssd%2Caps%2C214&sr=8-4 Would be cool if someone could take a look at this SSD 🙂 Unfortunately I don't know much about it, which is why I would be happy to accept other suggestions as long as they don't cost more than around 70€. Thank you in advance
I want to connect an external hard drive to the PS5, but I'm not sure if it's worth buying an SSD. An HDD is cheaper and offers more storage space, but is an SSD really that much better for the PS5?
Is it better than veracrypt
I got a new SSD and moved some of my internal SSD to the external one. 14GB more on the external one is… not good. Can anyone tell me why this is? And is it fixable? On the left is the external drive and on the right is my internal drive… It was formatted from…
Looking for an m.2 ssd with 1 tb storage for under 70€
chatgpt asked?
You:
Batch file: I want to copy all new files with the name 1234 to another folder from different folders, where already copied files are not to be copied a second time (even if they have been deleted from the target folder)
ChatGPT:
To convert this into a batch file, you can use a combination of xcopy and a tracking mechanism. A list of all already copied files is run so that only new files are copied.
Here is an example of a batch file that converts this:
batch
Declaration:
targetDir: Specifies the target folder in which the files are to be copied.
logFile: This file stores the paths of the already copied files.
filePattern: The search pattern for the files (eg 1234* for all files that start with 1234).
rootDir: The root folder where the files are searched.
findstr: Checks if the path of the file already exists in the log file.
xcopy: Copy the file to the target folder.
echo %%~ff >> "%logFile%": Inserts the path of the successfully copied file into the log file.
Notes:
Replace the paths (targetDir, logFile, rootDir) and the search pattern (filePattern) with the specific values ​​for your application.
The log file ensures that files that have already been copied are not copied again, even when deleted in the destination folder.
This batch file can now be executed to copy all new files with the name 1234 (or another pattern) from the different folders to the destination folder without creating duplicate copies.
Thank you
It worked almost 100%. How to copy only the 1234.mkv files
take this part:
by this one:
Only an empty .txt file is created in the target folder. Something’s wrong
# Define source and target folders
$sourceFolder = “E:\”
$destinationFolder = “Z:\New folder\GZSZ”
# File to save already copied files
$logFile = “$destinationFolder\copied_file.txt”
# Ensure that the log file exists
if (-not (Test-Path -Path $logFile) {
New-ItemType File -Path $logFile -Force
}
# Find all files with pattern GZSZ*.mkv in source folder
$files = Get-ChildItem -Path $sourceFolder Filter “GZSZ*.mkv”
♪ Download already copied files
$copiedFiles = Get-Content-Path $logFile
foreach ($file in $files) {
$destinationFile = Join-Path -Path $destinationFolder -ChildPath $file.Name
# Check if the file has already been copied
if (-not ($copiedFiles -contains $file.Name) {
# Copy file
Copy-Item -Path $file.FullName -Destination $destinationFile
# Add file name to log file
Add-Content -Path $logFile -Value $file.Name
Write-Output “File $($file.Name) was copied.”
} else
Write-Output “File $($file.Name) has already been copied, skip.”
}
}
you can try this powershell script:
do not call .bat but .ps1, right click on it and click on “Run with powershell”.
Unfortunately, the command does not work.
where already copied files are not to be copied a second time (even if they were deleted from the target folder)
All files are always copied.mkv
It’s not working. Scanning only
You seem to be on Win – there would be the means of choosing the command “robocopy”. But he really has a huge list of command line parameters – that’s what you need to find out for your application.
However, you will hardly be able to do that with the “even if they have been deleted from the target folder” because it re-enters both directories on each run. I don’t know another program.
What would work naturally – but you would have to get into programming:
that roughly corresponds to the batch file of AntiVegetarier1
The “even if they were deleted from the target folder” is relatively complex to implement. If I understand that correctly, it would probably have to create a file that contains a list with all the data that were copied once.