- Delete all files of .ext in source folder
- Randomly select folder either by naming pattern or any other means.
- Then copy all *.ext files from randomly selected folder to source folder [if easier can just copy whole folder contents].
- To be run as a batch file in a windows environment.
Example batch script (still have no idea how to code): delete-and-copy.cmd
call del C:\test\source\*.ext call Copy *.ext C:\test\library\group_%RANDOM% [COUNT=Folders %RANDOM%=Select1(%COUNT%)] "C:\test\source\"
OR another not working suggestion:
call del C:\test\source\*.ext @echo off setlocal EnableDelayedExpansion cd C:\test\library\ set n=0 for %%f in (*.ext) do ( set /A n+=1 set "folder[!n!]=%%f" ) set /A "rand=(n*%random%)/Count_1_%_10" copy "!group_[%rand%]!/*.ext" C:\test\source\
C:\test\source\delete-and-copy.cmd C:\test\source\ (150 *.ext files plus few others) C:\test\library\group_01\ (150 *.ext Files) C:\test\library\group_02\ (150 *.ext Files) C:\test\library\group_03\ (etc..) C:\test\library\group_04\ C:\test\library\group_05\ C:\test\library\group_06\ C:\test\library\group_07\ C:\test\library\group_08\ C:\test\library\group_09\ (...) C:\test\library\group_10\ (127 *.ext Files)
SU – How do I select a random file in a folder? – with further reading
SU – Move folders using wildcard
SU – Can I copy multiple files from single folder to multiple folder in windows with batch file?
SU – Batch file to copy a file at random to another folder
SO – Need to create a batch file to select one random file from a folder and copy to another folder
SO – Delete all files of specific type (extension) recursively down a directory using a batch file
If you want a simple explanation of what I want instead of the full context just read what is in bold.
I’m working on a projects that replicates an old telnet server, running off of batch code. I need to create the who command, a command that would list recent users and how long ago they issued a command. I have it set up so that every time a user runs a “command” it echos a variable into a file in a folder called
online with the file name set to their username. Now, to have the who command work I need to be able to process how long ago the command was issued. That being said, I really only want it to show users that issued a command in the last five minutes.
So basically what I need is to do is the following:
1] I need to be able to delete files from a directory that are older than five minutes old.
2] I need to be able to get how long ago a file (specifically those remaining files) was modified in a format like:
This file was modified 5 Minutes and 32 Seconds ago. if the file was only modified 5 seconds ago it would preferably be formatted
This file was modified 5 seconds ago. And the file having been created under a second ago cant crash it. I don’t care if it says
created 0 seconds ago but it cant say
created (blank) seconds ago.
Because of how it is set up it does not have to be locale dependent. Here is an example of what
%date% are set to on my machine:
Sat 03/23/2019, 17:49:47.98
I originally had it set so that it would echo the date and time with no colons or slashes into those files, but it has not been dependable for mathematical calculations.
So i got this DDPG implementation and i wanted to try to apply batch_normalization on it, but i can’t figure out how to do it, it seems to be really difficult?!
Could somebody help me out?
DPPG Code: https://github.com/MorvanZhou/Reinforcement-learning-with-tensorflow/blob/master/contents/9_Deep_Deterministic_Policy_Gradient_DDPG/DDPG_update2.py
I am working on a SQL problem and need help with moving data from the source table which has millions of rows in one database in SQL server into a newly created table which is in another database using Batch Insert statements and I am trying to use SQL to do that.
I tried doing a INSERT () SELECT * FROM foobar and after half an hour I got an error message complaining server capacity. I am trying to do divide the problem and do a batch file load and googled to see if I could use SQL but all the examples I come across are using some program like SSIS package or another third party tool which is not what I want.
So how can I essentially do the initial transfer of say 100,000 rows and then begin from the 100,001 row ?
We Already Have 16 colors in there.
0 = Black 8 = Gray 1 = Blue 9 = Light Blue 2 = Green A = Light Green 3 = Aqua B = Light Aqua 4 = Red C = Light Red 5 = Purple D = Light Purple 6 = Yellow E = Light Yellow 7 = White F = Bright White`
but i want to use more colors in there. in Batch File “Ascii”
I am trying to get the MD5 values of all files in sub folders that are in external file PathList.txt. I can’t make the script use the path names as define in
In the example I used
"C:\Temp\example\" in the place of
%%i so the script will work.
@ECHO off echo Files MD5 > MD5_log.txt FOR /F %%i IN (PathList.txt) DO ( @FOR /R "C:\Temp\example\" %%G in (*) DO ( for %%a in (%%G) do certutil -hashfile "%%~a" MD5 | find /i /v "certutil">> MD5_log.txt ) )
This is for old computer, s I don’t have Powershell option.
How can I make it work? Thanks
I have been researching and trying without success to get the current directory name into a variable such as %CurrDirNam% for creating a text file with the same folder name something like this: copy %CurrDirNam% > nul 1.txt. The only similar questions I can locate require that the folder name be supplied rather than fetching it from the OS for use as a variable. Reference1 How to set a folder name into a variable to use it in the same Batch file? Reference2 Batch: Set Top-Level Folder Name as Variable
My Missing.txt output is listing all the filenames contained in filelist.txt instead of listing only the filenames that are missing from C:\folder\filenames.
What I want:
1. Compare filenames from C:\folder\filelist.txt to C:\folder\filenames
2. Output missing files names from C:\folder\filenames to Missing.txt
for /f “tokens=*” %%i in (C:\folder\filelist.txt) DO (
IF EXIST %%i (echo %%i>>C:\folder\filenames) ELSE echo %%i>>C:\folder\Missing.txt
Thank you in advance for any help you may be able to provide.
This will greatly reduce the amount of time I spend on a work task.
I’ve notice on other answers there are ways to use the History Stack in Darktable to batch convert a bunch of RAW images. However, since I really only want to use Darktable convert (export) a lot of RAW images as 8-bit uncompressed / lossless TIFF’s, I wondered if this is possible somehow?
I need to compare file size to disk free space in BATCH. Does anyone know how to do that ?