Batch files - names [closed] - string

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I have a code that looks for png files with a specific pattern on the desktop and moves them to another directory.
While going over the files, I want to check if there is the pattern in the name.
This is how I did it:
for %%f in (C:\Users\user\Desktop\*.png) do (
if %%f==Hearthstone Screenshot*.png (
move %%f C:\destination\
)
)
Note: All the needed files start with Hearthstone Screenshot then some numbers.
My main problem is in line 2. I can't make it work.

Depending upon you needs, perhaps this is what you're looking for…
#RoboCopy "%UserProfile%\Desktop" "%UserProfile%\Desktop\HearthStone_Screenshots" "HearthStone Screenshot*.png" /MOV>Nul 2>&1
This should automatically create the holding directory, HearthStone_Screenshots if it doesn't already exist.
Note:I have corrected what I'm assuming to be your very poor spelling issues. If those files and directories should be named using ea instead of ee please re-adjust as necessary.

What's wrong with this:
move C:\Users\user\Desktop\HearthstoneScreanshot*.png C:\Users\user\Desktop\Hearthstonescreanshot\

Related

Why "rsync --exclude-from" ist not working [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Hi I'm trying to sync local files to a remote server, the files are copied, but the excluded files are not working.
What I want to exlude is some files, under some different folders for example:
htdocs/index.php
htdocs/.htaccess
htdocs/conf/Configuration.php
rsync -arvz --no-links --exclude-from 'excluded-files.txt' ./htdocs/ user#host:/var/www/test/htdocs/
What's going wrong?
Unless you are using -R, the exclude patterns are matched against the subdirectories of the from directory. In your case you must exclude index.php rather than htdocs/index.php, but that might match too many such files. By adding -R instead, the name you will test against will be ./htdocs/..., so the patterns will work, but you then need to remove htdocs from the destination directory, i.e. user#host:/var/www/test/

How to convert a temp folder( .tmp ) to a binary file ( .bin) in Linux [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
enter image description here
enter image description herei.stack.imgur.com/emphasized text8kFIB.png
I want to convert the folder into a binary file(.bin),I tried to write a shell file, but it not generate the correct binary file,I do not know how to solve it,maybe my solution is wrong.Someone tells me that I can use the command zip,I can not agree....C
From your remark about zip, it seems you are trying to make an archive. One simple way to create an archive of a directory is with tar:
tar -zcf foo.tgz /path/to/foo
Note that this will create a file named foo.tgz rather than *.bin, but .... you don't really want to use the bin suffix for a tarball.

Replace URL in markdown files in python [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 2 years ago.
Improve this question
I have big markdown file. Is there any way to change /foo in my url by /bla. That is, I want to replace
[text](/foo/some-long-url/a.html)
for
[text](/bla/some-long-url/a.html)
(all ocurrences).
I know I could compile markdown file to html and use html parsers (like BeautifulSoup) to do that. But I want to do that, on the source file.
Prefered python or shell solutions.
I mean you can always replace "/foo" to "/bla" directly in the source using sed?
sed 's/\/foo/\/bla/' source.md >> destination.md
If it catches anything unwanted, you can just tweak the regular expression a bit to be more specific.

Temprarly change $PATH only for the script run [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
I hope that you can help me with the following problem: I want to implement a script that requires that $PATH variables has missing . value changes in it.
The point of the script is to find requested files and copy them to parent directory. I can do this using -execdir, but the problem is that . is defined in the $PATH.
Can you please tell me how can I provide a temporary replacement for the $PATH variable that can be valid only for the script execution.
Thanks
The shell allows you to set environment variables of an executable by passing them to the invocation. Like this:
PATH="/foo/bar" program

Restore trash item to original location - Linux [closed]

Closed. This question is off-topic. It is not currently accepting answers.
Want to improve this question? Update the question so it's on-topic for Stack Overflow.
Closed 10 years ago.
Improve this question
I'm wondering if it is possible to restore a file that is in the trash (~/.Trash) to its original location.
I understand there is a restore command but I don't understand its arguments or how to correctly use it.
Is this a fairly simple thing to do?
Cheers
If your desktop environment followed the XDG Trash Can Specification when trashing the file, then restore-trash from trash-cli would do the trick.
What desktop do you use?
.Trash is just a (hidden) directory. All you need to do is move it out:
mv ~/.Trash/foo ~/
or using the file browser of your desktop environment, open the trash and drag it out.
As far as I know, in the trash folder (~/.local/share/Trash/), there is a folder with the files (files/) and a folder with the file information (info/). Each file has an associated .trashinfo file in which the original path and time of deletion are stored. You can use that to restore the file to its original location.

Resources