How to use wildcard in Windows command-line? - windows

I some animations, they are like this:
/OP/
/OP/OP1/
/OP/OP1/OP1.rmvb
/OP/OP2/
/OP/OP2/OP2.rmvb
/OP/OP3/
/OP/OP3/OP3.rmvb
/OP/OP4/
/OP/OP4/OP4.rmvb
...and more
I want to make it like
/OP/
/OP/OP1.rmvb
/OP/OP2.rmvb
/OP/OP3.rmvb
/OP/OP4.rmvb
I tried
move \OP\*\*.rmvb \OP
It gave me error says
The file name, directory name, or volume label syntax is incorrect.
I also tried
dir \OP\*
This shows all the folders
But if I try
dir \OP**
It gave me the same error.
Could anyone please help me?? Thank you very much

Is that a programming question? Requiring to do this on the command line?
Otherwise, I would just do a Windows Search *.rmvb, and drag'n'drop the result to the folder of your choice...

Related

How to remove a reoccuring word/character and what comes after, from the filenames of multiple files?

I have several folders of video files where, due to the download manager I use, they are all named in the following format "FILENAME.mp4; filename= FILENAME.mp4" All I've been trying to do is to remove everything after (and including) ".mp4; filename". However, I haven't found a way to do this.
I have tried some free software (such as Renamer, Namechanger, Name Munger for Mac, Transnomino) but I failed to do what I need to.
I'm working on Mac OSX 10.13.6.
Any help with this issue would be appreciated.
You can achieve it using Terminal. Go to the folder where you want to rename files using this cd command, for example:
cd ~/Documents/Videos
And run this command to rename all files recursively:
find . -iname "*.mp4;*" | sed -E 's/(\.[^\.]*)(\.mp4)(.*)/mv "\1\2\3" "\1\2"/' | sh
This command will keep only FILENAME.mp4 part from FILENAME.mp4; filename= FILENAME.mp4 file name
I used to extensively use a windows Rename tool called Renamer 6.0, and it had a "pattern rename" facility called "Multi change" that could have handled this.
In the context of that tool it would be asking for a source pattern like %a= %b and a destination pattern (like %b), everything after the = would be stored in %b variable and then renaming the file to just %b would lose everything after the =
See if your preferred rename tool has a similar facility?
If your tool supports regex, then find: .*?=(.*) and replace with $1
I'm also minded that asking this question on https://unix.stackexchange.com/ might elicit some help crafting a shell script that will perform this rename (though also plenty of shell capable people here, one of them may see it - it's just that it's not quite as hardcore programmer-y a question as most).
If you're willing to learn/use java, then that could be another good way to get the problem solved. It would (at a guess) look something like this:
for (final File f : new File("C:\\temp").listFiles()) {
if (f.isFile()) {
string n = f.getName();
if (n.contains("=")) {
f.renameTo(new File(n.substring(n.indexOf("=")+1));
}
}
}

Latex - Bibtex/BibLatex - How can I include a file with space in the path?

I am using Mac and
\usepackage{natbib}
It seems that the space in the path caused problems, i.e. Box Sync.
\bibliography{/Users/c082213/Box Sync/AA_My_Papers/MyStats.bib}
I have tried to put them in double "", and it doesn't work on Mac. Is there anyway that we can fix this?
Many thanks!
one solution is to use a relative path.
If the .bib and the .tex file are in the same folder you can just write:
\bibliography{MyStats}
On the other hand, there are many other possible solutions to handle the problem with with spaces in the path. My suggestion is: avoid it to name folders or files with spaces. It will produce problems for some reasons.
I had the same issue with Box and it's default usage of spaces, so I created a soft link having no spaces:
ln -s "Box Sync" Boxsync
then I can use the bibliography command as usual.

Copy files from a list.txt, output error log

I have read many posts covering copy and xcopy, but i am unable to get my command to work.
I aim is to create a batch file that will do the following;
Search a directory structure for a list of files 'names only' if found copy them to another directory. If not found create an error list.
The txt format of files I am looking for can be in any format however in testing i have a text file like this;
1603010853
1603020845
1603141400
1604061215
The files are .PDF or .TIF
The directory structure that I am searching is like this;
X:DEL>16>160314>1603141400.pdf
X:DEL>16>160301>1603010853.tif
I am struggling to get it to work as the list is not the full path.
for /f "tokens=*" %i in (File-list.txt) DO xcopy /S/E "c:Test\In%i" "c:out"
Thanks in advance
Fostersimported
Alrighty, if tool doesn't matter much, I'd suggest going with the PowerShell script attached to this SuperUser post. It seems to do everything you want (including logging errors). You'd need only copypasta that into a text file, name it accordingly, and go from there.

How to load Prolog files

How do I load files into Prolog? I type in the filename followed by a . but I get an error. Maybe I have to tell Prolog where to look, but am unsure on how to tell it?
You didn't specify what exactly error message you got, but from "Maybe I have to tell Prolog where to look" I assume you got something like "file not found".
Let's suppose you use a Windows operating system and you have a file named 'file1.pl' in the directory "C:\Users\Name\Prolog\".
Then you can use following commands in Prolog to consult your file (note forward, not back, slashes):
cd('C:/Users/Name/Prolog').
['file1.pl'].
Adjust the commands to your path and file names.

Is there a way to compile Pascal program and put the generated files in a specific folder?

So I am trying to compile Pascal programs and everything is find; however, I would like to put the generated files after each compilation is a separated folder. I am looking of something like this: fpc "Destination Folder" "program.pas".
Thanks
From Alphabetical listing of command line options
-FE<x> Set exe/unit output path to <x>
-FU<x> Set unit output path to <x>, overrides -FE
So something like fpc program.pas -FEc:\output should work. I don't have fpc installed so I cannot verify. If you try it and get errors that you can't work through post them.
This one works for me:
fpc hello.pas -o"Web/hello.cgi"
I was using ubuntu, notice there is no space between the argument -o and the beginning of the path "Web/..."

Resources