Thank you in advance for any advice. (unfortunately, i only have a very rudimentary knowledge of cmd.)
I have just copied a folder structure with subfolders without file contents from a directory to create a template folder (using cmd.exe). However, this also copies subfolders that I will not need.
Ideally, I would like to do exclude them by using a .txt file, as it can happen that i don't need a list of subfolders and typing them in individually in cmd.exe is tedious.
Copying the folders worked and gave me as output:
C:\Windows\system32>robocopy "I:\BIM\Bibliothek\05_Familien\529_TFS_2021" "C:\Users\dfeyer\Desktop\test" /MIR /NOCOPY
-------------------------------------------------------------------------------
ROBOCOPY :: Robustes Dateikopieren für Windows
-------------------------------------------------------------------------------
Gestartet: Donnerstag, 10. Juni 2021 15:14:36
Quelle : I:\BIM\Bibliothek\05_Familien\529_TFS_2021\
Ziel : C:\Users\dfeyer\Desktop\test\
Dateien : *.*
Optionen: *.* /S /E /NOCOPY /PURGE /MIR /R:1000000 /W:30
------------------------------------------------------------------------------
0 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\
Neues Verz. 7 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Allgemeines Modell\
Neues Verz. 21 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Beschriftung\
Neues Verz. 11 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Beschriftung\_Archiv\
Neues Verz. 3 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Fassadenelemente\
Neues Verz. 33 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Fenster\
Neues Verz. 12 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Fenstertür\
Neues Verz. 12 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Möbel\
Neues Verz. 2 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Parkplatz\
Neues Verz. 3 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Profil\
Neues Verz. 6 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\TGA Sanitär\
Neues Verz. 15 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Türen\
------------------------------------------------------------------------------
Insgesamt KopiertÜbersprungenKeine Übereinstimmung FEHLER Extras
Verzeich.: 12 11 1 0 0 0
Dateien: 125 0 125 0 0 0
Bytes: 85.35 m 0 85.35 m 0 0 0
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Beendet: Donnerstag, 10. Juni 2021 15:14:37
Reading the lines in .txt file was also possible:
C:\Windows\system32>type C:\Users\dfeyer\Desktop\withoutDirectories.txt
_Archiv
_NESTED
I tried this approach, but it seems, that this excludes the .txt from beeing copied, not the Subfolders with the specified names in .txt -file:
C:\Windows\system32>robocopy "I:\BIM\Bibliothek\05_Familien\529_TFS_2021" "C:\Users\dfeyer\Desktop\test" /MIR /NOCOPY /XD dirs C:\Users\dfeyer\Desktop\withoutDirectories.txt
-------------------------------------------------------------------------------
ROBOCOPY :: Robustes Dateikopieren für Windows
-------------------------------------------------------------------------------
Gestartet: Donnerstag, 10. Juni 2021 15:53:31
Quelle : I:\BIM\Bibliothek\05_Familien\529_TFS_2021\
Ziel : C:\Users\dfeyer\Desktop\test\
Dateien : *.*
Ausgeschl. Verzeichnisse: dirs
C:\Users\dfeyer\Desktop\withoutDirectories.txt
Optionen: *.* /S /E /NOCOPY /PURGE /MIR /R:1000000 /W:30
------------------------------------------------------------------------------
0 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\
Neues Verz. 7 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Allgemeines Modell\
Neues Verz. 21 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Beschriftung\
Neues Verz. 11 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Beschriftung\_Archiv\
Neues Verz. 3 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Fassadenelemente\
Neues Verz. 33 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Fenster\
Neues Verz. 12 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Fenstertür\
Neues Verz. 12 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Möbel\
Neues Verz. 2 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Parkplatz\
Neues Verz. 3 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Profil\
Neues Verz. 6 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\TGA Sanitär\
Neues Verz. 15 I:\BIM\Bibliothek\05_Familien\529_TFS_2021\Türen\
------------------------------------------------------------------------------
Insgesamt KopiertÜbersprungenKeine Übereinstimmung FEHLER Extras
Verzeich.: 12 11 1 0 0 0
Dateien: 125 0 125 0 0 0
Bytes: 85.35 m 0 85.35 m 0 0 0
Zeiten: 0:00:00 0:00:00 0:00:00 0:00:00
Beendet: Donnerstag, 10. Juni 2021 15:53:32
How can I link the lines of code so that unwanted subfolders named "_Archiv" & "NESTED" won´t be copied?
Related
I have a simple docker container that is based on windows image:
FROM mcr.microsoft.com/windows:1903
WORKDIR /app1/
ENTRYPOINT powershell.exe
I run it interactively, using:
docker run -it -v c:\app1:c:\app1 test-image:1.0
There is a file called 1.txt inside app1 folder.
When I run:
.\app1\1.txt
I see no notepad.exe process, but instead I can spot OpenWith process:
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
78 5 1056 4452 0.02 1940 1 CExecSvc
74 5 5360 3792 0.02 1904 1 cmd
81 5 904 1364 0.00 1844 1 CompatTelRunner
156 10 6532 6088 0.00 1728 1 conhost
97 7 1196 4980 0.05 1896 1 conhost
286 13 1836 4976 0.27 984 1 csrss
37 6 1348 3356 0.06 524 1 fontdrvhost
0 0 60 8 0 0 Idle
831 22 4748 13844 0.17 460 1 lsass
546 25 13156 28920 0.17 1952 1 OfficeClickToRun
420 24 7400 28844 0.13 2472 1 OpenWith
376 22 6732 27168 0.13 2536 1 OpenWith
I suspect that some mapping might be missing, event though assoc shows that .txt file is associated with notepad.exe:
assoc .txt
.txt=txtfile
ftype txtfile
txtfile=%SystemRoot%\system32\NOTEPAD.EXE %1
What might be the problem here? Am I missing some register value?
This question already has answers here:
Looping through directories in Bash
(3 answers)
How to loop over directories in Linux?
(11 answers)
Looping over directories in Bash
(3 answers)
Closed 4 years ago.
I have one directory with 48 sub-directories such like:
output$ ll
total 0
drwxr-sr-x+ 1 xxx 576 Apr 27 16:39 ./
drwxrws---+ 1 xxx 254 May 4 15:12 ../
drwxrws---+ 1 xxx 28 Apr 19 16:31 404904/
drwxrws---+ 1 xxx 28 Apr 19 16:31 404905/
drwxrws---+ 1 xxx 28 Apr 19 16:31 405003/
drwxrws---+ 1 xxx 28 Apr 19 16:31 405050/
drwxrws---+ 1 xxx 28 Apr 19 16:31 405077/
...
I wanted to write a bash for loop to work on some common analysis in them such like:
for d in {404904,404905,405503,...};
do
echo $d
done
My question is how to loop these sub-directories instead of manually type in.
for d in */; do
echo "${d%/}"
done
I get the below error message when I try to rsync from a local hard disk to a USB disk mounted at E: on Windows 10.
rsync: failed to set times on "/cygdrive/e/.": Invalid argument (22)
My rsync command is as below (path shortened for brevity):
rsync -rtv --delete --progress --modify-window=5 /cygdrive/d/path/to/folder/ /cygdrive/e/
I actually need to set modification times (on directories as well) and rsync actually sets modification times perfectly. It only fails to set times on root of the USB disk.
I experienced exactly the same problem.
I created a dir containing one text file and when trying to rsync it to an removable (USB) drive, I got the error. However, the file was copied to the destination. The problem is not reproducible if the destination is a folder (other than root) on the removable drive
I then repeated the process using a fixed drive as destination, and the problem was not reproducible
The 1st difference that popped up between the 2 drives, was the file system (for more details, check [MS.Docs]: File Systems Technologies):
FAT32 - on the removable drive
NTFS - on the fixed one
So this was the cause of my failure. Formatting the USB drive as NTFS fixed the problem:
The USB drive formatted as FAT32 (default):
cfati#cfati-e5550-0 /cygdrive/e/Work/Dev/StackOverflow/q045006385
$ ll /cygdrive/
total 20
dr-xr-xr-x 1 cfati None 0 Jul 14 17:58 .
drwxrwx---+ 1 cfati None 0 Jun 9 15:04 ..
d---r-x---+ 1 NT SERVICE+TrustedInstaller NT SERVICE+TrustedInstaller 0 Jul 13 22:21 c
drwxrwx---+ 1 SYSTEM SYSTEM 0 Jul 14 13:19 e
drwxr-xr-x 1 cfati None 0 Dec 31 1979 n
drwxr-xr-x 1 cfati None 0 Dec 31 1979 w
cfati#cfati-e5550-0 /cygdrive/e/Work/Dev/StackOverflow/q045006385
$ rsync -rtv --progress --modify-window=5 ./dir/ /cygdrive/w
sending incremental file list
rsync: failed to set times on "/cygdrive/w/.": Invalid argument (22)
./
a.txt
3 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/2)
sent 111 bytes received 111 bytes 444.00 bytes/sec
total size is 3 speedup is 0.01
rsync error: some files/attrs were not transferred (see previous errors) (code 23) at main.c(1196) [sender=3.1.2]
cfati#cfati-e5550-0 /cygdrive/e/Work/Dev/StackOverflow/q045006385
$ ll /cygdrive/
total 20
dr-xr-xr-x 1 cfati None 0 Jul 14 17:58 .
drwxrwx---+ 1 cfati None 0 Jun 9 15:04 ..
d---r-x---+ 1 NT SERVICE+TrustedInstaller NT SERVICE+TrustedInstaller 0 Jul 13 22:21 c
drwxrwx---+ 1 SYSTEM SYSTEM 0 Jul 14 13:19 e
drwxr-xr-x 1 cfati None 0 Dec 31 1979 n
drwxr-xr-x 1 cfati None 0 Dec 31 1979 w
After formatting the USB drive as NTFS:
cfati#cfati-e5550-0 /cygdrive/e/Work/Dev/StackOverflow/q045006385
$ ll /cygdrive/
total 24
dr-xr-xr-x 1 cfati None 0 Jul 14 17:59 .
drwxrwx---+ 1 cfati None 0 Jun 9 15:04 ..
d---r-x---+ 1 NT SERVICE+TrustedInstaller NT SERVICE+TrustedInstaller 0 Jul 13 22:21 c
drwxrwx---+ 1 SYSTEM SYSTEM 0 Jul 14 13:19 e
drwxr-xr-x 1 cfati None 0 Dec 31 1979 n
drwxrwxrwx+ 1 Administrators Administrators 0 Jul 14 17:59 w
cfati#cfati-e5550-0 /cygdrive/e/Work/Dev/StackOverflow/q045006385
$ rsync -rtv --progress --modify-window=5 ./dir/ /cygdrive/w
sending incremental file list
./
a.txt
3 100% 0.00kB/s 0:00:00 (xfr#1, to-chk=0/2)
sent 111 bytes received 38 bytes 298.00 bytes/sec
total size is 3 speedup is 0.02
cfati#cfati-e5550-0 /cygdrive/e/Work/Dev/StackOverflow/q045006385
$ ll /cygdrive/
total 24
dr-xr-xr-x 1 cfati None 0 Jul 14 17:59 .
drwxrwx---+ 1 cfati None 0 Jun 9 15:04 ..
d---r-x---+ 1 NT SERVICE+TrustedInstaller NT SERVICE+TrustedInstaller 0 Jul 13 22:21 c
drwxrwx---+ 1 SYSTEM SYSTEM 0 Jul 14 13:19 e
drwxr-xr-x 1 cfati None 0 Dec 31 1979 n
drwxrwxrwx+ 1 Administrators Administrators 0 Jul 14 13:19 w
As a side note, when I was at step #2., I was an idiot and kept the --delete arg, so til I hit Ctrl + C, it deleted some data. Luckily, it didn't get to delete crucial files / folders.
I've a file like below.
ab13p29im-sss29511
0
Jan 12 22:43
ab13p29im-sss29531
0
Jan 12 22:43
ab13p29im-sss29512
0
Feb 2 16:11
ab13p29im-sss29522
0
Feb 2 16:12
ab13p29im-sss29532
0
Feb 2 16:12
ab21p30im-sss30511
0
Jan 12 22:43
ab21p30im-sss30531
0
Jan 12 22:43
ab21p30im-sss30512
0
Feb 2 16:13
ab21p30im-sss30522
3
Feb 2 16:12
i want to print this is below format.
ab13p29im-sss29511 0 Jan 12 22:43
ab21p30im-sss30522 0 Feb 2 16:12
ab21p30im-sss30531 0 Jan 12 22:43
I'm using the command paste - - - < inputfile.But if any of the value is null, the format is all messed up like below?
ab13p29im-sss29511 0 Jan 12 22:43
ab21p30im-sss30522 0 ab21p30im-sss30531
0 Jan 12 22:43 ab21p30im-sss30523.
Like if there's no date for any host or if any value is null, it breaks the 3,3,3 pattern.
You like some like this:
awk 'ORS=NR%3?" ":RS' file
ab13p29im-sss29511 0 Jan 12 22:43
ab13p29im-sss29531 0 Jan 12 22:43
ab13p29im-sss29512 0 Feb 2 16:11
ab13p29im-sss29522 0 Feb 2 16:12
ab13p29im-sss29532 0 Feb 2 16:12
ab21p30im-sss30511 0 Jan 12 22:43
ab21p30im-sss30531 0 Jan 12 22:43
ab21p30im-sss30512 0 Feb 2 16:13
ab21p30im-sss30522 3 Feb 2 16:12
sed 'N;N;s/\n/ /g' YourFile
Load 2 lines, remove new line before printing it then cycle
you could secude by putting a pattern check to initiate the cycle like /[a-b0-9]\{9\}-[a-b0-9]\{8\}/!d; before first N
By using awk command and explicit concatenation:
$ awk 'NR % 3 == 1 { lines=$0 ; next } { lines=lines" "$0 } NR % 3 == 0 { print lines ; lines="" }' file
ab13p29im-sss29511 0 Jan 12 22:43
ab13p29im-sss29531 0 Jan 12 22:43
ab13p29im-sss29512 0 Feb 2 16:11
ab13p29im-sss29522 0 Feb 2 16:12
ab13p29im-sss29532 0 Feb 2 16:12
ab21p30im-sss30511 0 Jan 12 22:43
ab21p30im-sss30531 0 Jan 12 22:43
ab21p30im-sss30512 0 Feb 2 16:13
ab21p30im-sss30522 3 Feb 2 16:12
I am trying to change all the files names in a current folder and I am trying to achieve this either by removing the files prefix (every file has a common prefix) or changing their names to their count (if there are 5 files, the filenames will be 1.txt 2.txt 3.txt 4.txt 5.txt).
Now I have found the ren command in cmd and played with it a little but so far I was not able to achieve the result and I can only run this in cmd, so no batch files can be used.
This is the closest that I got, but it only adds a prefix:
FOR %f IN (*.*) DO ren %f prefix%f
I have tried doing the opposite:
FOR %f IN (*.*) DO ren prefix%f %f
But of course, didn't work so I am now asking for help and some explanation if possible (I like to understand how these things work). Thanks in advance for any help.
A much simpler solution is provided in
https://superuser.com/a/871799/497147
I copied it here for easier access.
Forget about complicated scripts for this.
rename is a very old and never properly completed command. If you do not use it properly, the result might surprise you.
For example to remove a prefix abcd from abcd1.txt, abcd2.txt, abcd3.txt etc. in order to get 1.txt, 2.txt, 3.txt simply use
rename "abcd*.txt" "////*.txt"
You need the same number of / as the number of initial characters you would like to remove.
Do place double quotes for both arguments.
I don't understand why you can't use a batch file. But here is a solution that should work with most file names.
Critical - first you must make sure you have an undefined variable name, I'll use fname
set "fname="
Next is the command to actually do the renaming. It won't work properly if fname is already defined.
for %a in (prefix*.txt) do #(set "fname=%a" & call ren "%fname%" "%fname:*prefix=%")
The fname variable is defined for each iteration and then the syntax %fname:*prefix=% replaces the first occurrence of "prefix" with nothing. The tricky thing is Windows first attempts to expand %fname% when the command is first parsed. Of course that won't work because it hasn't been defined yet. On the command line the percents are preserved if the variable is not found. The CALL causes an extra expansion phase that occurs after the variable has been set, so the expansion works.
If fname is defined prior to running the command, then it will simply try to rename that same file for each iteration instead of the value that is being assigned within the loop.
If you want to run the command again with a different prefix, you will have to first clear the definition again.
EDIT - Here is a batch file named "RemovePrefix.bat" that does the job
::RemovePrefix.bat prefix fileMask
#echo off
setlocal
for %%A in ("%~1%~2") do (
set "fname=%%~A"
call ren "%%fname%%" "%%fname:*%~1=%%"
)
Suppose you had files named like "prefixName.txt", then you would use the script by executing
RemovePrefix "prefix" "*.txt"
The batch file will rename files in your current directory. The batch file will also have to be in your current directory unless the batch file exists in a directory that is in your PATH variable. Or you can specify the full path to the batch file when you call it.
The rules for expansion are different in a batch file. FOR variables must be referenced as %%A instead of %A, and %%fname%% is not expanded initially, instead the double percents are converted into single percents and then %fname% is expanded after the CALL. It doesn't matter if fname is already defined with the batch file. The SETLOCAL makes the definition of fname temporary (local) to the batch file.
You can do it this way (let's say your prefix is "AS"):
x=1; for k in AS*; do y=$((x++)); echo "mv ${k} ${k:0:2}$y.txt"; done
if you want to save extensions use this (pre-test):
x=1; for k in AS*; do y=$((x++)); echo "mv ${k} ${k:0:2}$y.${k#*.}"; done
if pre-test is OK then remove echo and code will run this time:
x=1; for k in AS*; do y=$((x++)); mv ${k} ${k:0:2}$y.txt; done
*for saving extensions (remove echo and code will run this time):
x=1; for k in AS*; do y=$((x++)); mv ${k} ${k:0:2}$y.${k#*.}; done
${k:0:2} --> first two letters of file 0 to 2...
${k#*.}--> extension of the file
I had a similar situation myself and solved it.
My files were like this:
1-6-4-20.txt onar.mol2 replace.py z.out z__06.mol2 z__09.mol2 z__12.mol2 z__15.mol2 z__18.mol2 z__27.mol2 z__30.mol2 z__33.mol2 z__36.mol2
make_com_files.py pt.dat valid.txt z.xyz z__07.mol2 z__10.mol2 z__13.mol2 z__16.mol2 z__25.mol2 z__28.mol2 z__31.mol2 z__34.mol2 z__37.mol2
makepymol.py pymol.pml x.py z__05.mol2 z__08.mol2 z__11.mol2 z__14.mol2 z__17.mol2 z__26.mol2 z__29.mol2 z__32.mol2 z__35.mol2
Note that there is no z_01.mol2 z_02.mol2 z_03.mol2 z_04.mol2 and z_19.mol2 z_20.mol2 etc.. so my z files are not in sequence. I can't get rid of the problem by omitting the z_* prefix. and also I have onar.mol2
Here is my solution:
pre-test using echo to see if it is working correctly:
x=1; for k in *.mol2; do y=$((x++)); echo "mv ${k%%.*}.mol2 $y.mol2"; done
output:
mv onar.mol2 1.mol2
mv z__05.mol2 2.mol2
mv z__05.mol2 2.mol2
mv z__06.mol2 3.mol2
mv z__07.mol2 4.mol2
mv z__08.mol2 5.mol2
mv z__09.mol2 6.mol2
mv z__10.mol2 7.mol2
mv z__11.mol2 8.mol2
mv z__12.mol2 9.mol2
mv z__13.mol2 10.mol2
mv z__14.mol2 11.mol2
mv z__15.mol2 12.mol2
mv z__16.mol2 13.mol2
mv z__17.mol2 14.mol2
mv z__18.mol2 15.mol2
mv z__25.mol2 16.mol2
mv z__26.mol2 17.mol2
mv z__27.mol2 18.mol2
mv z__28.mol2 19.mol2
mv z__29.mol2 20.mol2
mv z__30.mol2 21.mol2
mv z__31.mol2 22.mol2
mv z__32.mol2 23.mol2
mv z__33.mol2 24.mol2
mv z__34.mol2 25.mol2
mv z__35.mol2 26.mol2
mv z__36.mol2 27.mol2
mv z__37.mol2 28.mol2
seems correct then I can use this as a command for my aim (by removing echo):
x=1; for k in *.mol2; do y=$((x++)); mv ${k%%.*}.mol2 $y.mol2; done
RESULT: ls -ln:
-rwxrwxrwx 1 0 0 1695 Nov 18 12:07 1-6-4-20.txt
-rwxrwxrwx 1 0 0 1813 Nov 18 13:27 1.mol2
-rwxrwxrwx 1 0 0 2782 Nov 18 13:27 10.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 11.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 12.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 13.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 14.mol2
-rwxrwxrwx 1 0 0 2784 Nov 18 13:27 15.mol2
-rwxrwxrwx 1 0 0 2785 Nov 18 13:27 16.mol2
-rwxrwxrwx 1 0 0 2785 Nov 18 13:27 17.mol2
-rwxrwxrwx 1 0 0 2786 Nov 18 13:27 18.mol2
-rwxrwxrwx 1 0 0 2786 Nov 18 13:27 19.mol2
-rwxrwxrwx 1 0 0 2781 Nov 18 13:27 2.mol2
-rwxrwxrwx 1 0 0 2787 Nov 18 13:27 20.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 21.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 22.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 23.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 24.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 25.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 26.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 27.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 28.mol2
-rwxrwxrwx 1 0 0 2782 Nov 18 13:27 3.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 4.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 5.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 6.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 7.mol2
-rwxrwxrwx 1 0 0 2782 Nov 18 13:27 8.mol2
-rwxrwxrwx 1 0 0 2782 Nov 18 13:27 9.mol2
-rwxrwxrwx 1 0 0 1383 Nov 17 12:27 make_com_files.py
-rwxrwxrwx 1 0 0 5687 Nov 17 16:34 makepymol.py
-rwxrwxrwx 1 0 0 1206 Nov 17 11:36 pt.dat
-rwxrwxrwx 1 0 0 964 Nov 18 13:29 pymol.pml
-rwxrwxrwx 1 0 0 2288 Nov 18 13:27 replace.py
-rwxrwxrwx 1 0 0 1284 Nov 18 13:07 valid.txt
-rwxrwxrwx 1 0 0 3809 Nov 18 12:37 x.py
-rwxrwxrwx 1 0 0 19622334 Nov 18 04:11 z.out
-rwxrwxrwx 1 0 0 34717 Nov 18 12:37 z.xyz
enter code here
EXTRA:
and if I want my files as 00001.mol2 00002.mol2 etc, I can add this command too:
rename 's/\d+/sprintf("%05d",$&)/e' *.mol2
Here are my mol2 files:
-rwxrwxrwx 1 0 0 1813 Nov 18 13:27 00001.mol2
-rwxrwxrwx 1 0 0 2781 Nov 18 13:27 00002.mol2
-rwxrwxrwx 1 0 0 2782 Nov 18 13:27 00003.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 00004.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 00005.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 00006.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 00007.mol2
-rwxrwxrwx 1 0 0 2782 Nov 18 13:27 00008.mol2
-rwxrwxrwx 1 0 0 2782 Nov 18 13:27 00009.mol2
-rwxrwxrwx 1 0 0 2782 Nov 18 13:27 00010.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 00011.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 00012.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 00013.mol2
-rwxrwxrwx 1 0 0 2783 Nov 18 13:27 00014.mol2
-rwxrwxrwx 1 0 0 2784 Nov 18 13:27 00015.mol2
-rwxrwxrwx 1 0 0 2785 Nov 18 13:27 00016.mol2
-rwxrwxrwx 1 0 0 2785 Nov 18 13:27 00017.mol2
-rwxrwxrwx 1 0 0 2786 Nov 18 13:27 00018.mol2
-rwxrwxrwx 1 0 0 2786 Nov 18 13:27 00019.mol2
-rwxrwxrwx 1 0 0 2787 Nov 18 13:27 00020.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 00021.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 00022.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 00023.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 00024.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 00025.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 00026.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 00027.mol2
-rwxrwxrwx 1 0 0 2788 Nov 18 13:27 00028.mol2
-rwxrwxrwx 1 0 0 1695 Nov 18 12:07 1-6-4-20.txt
-rwxrwxrwx 1 0 0 1383 Nov 17 12:27 make_com_files.py
-rwxrwxrwx 1 0 0 5687 Nov 17 16:34 makepymol.py
-rwxrwxrwx 1 0 0 1206 Nov 17 11:36 pt.dat
-rwxrwxrwx 1 0 0 964 Nov 18 13:29 pymol.pml
-rwxrwxrwx 1 0 0 2288 Nov 18 13:27 replace.py
-rwxrwxrwx 1 0 0 1284 Nov 18 13:07 valid.txt
-rwxrwxrwx 1 0 0 3809 Nov 18 12:37 x.py
-rwxrwxrwx 1 0 0 19622334 Nov 18 04:11 z.out
-rwxrwxrwx 1 0 0 34717 Nov 18 12:37 z.xyz
Following is straight way to trim the prefix with rename for all the files
rename -d your_prefix *