For the Linux admins out there who have to occasionally use Windows, you can do the following from a Windows cmd prompt:
Nice article. I really like the following:
> If you're about to start writing a utility, take a bit of time to browse around a few systems to see if there might be one already. Don't be afraid to steal Linux utilities for use on BSD, or BSD utilities for use on Linux; one of the joys of utility code is that almost all utilities are quite portable.
I can't help but use Linux tools (using GOW) on my Windows systems.
The article's worth reading in full; I also like this part of the summary:
>Summary > > If you find yourself performing a task repeatedly, consider writing a program to do it. If the program turns out to be reasonable to generalize a bit, generalize it, and you will have written a utility.
A good view not just for Linux development. I have scripts for Windows and MATLAB (as well as Linux scripts and bash aliases) for things that I find tedious or simply things that I run often.
I'm using the WGET in this package https://github.com/bmatzelle/gow/ . The installation should add wget to your path.
Download a file
wget -c https:\someplace.com\path\path\file.mkv
Download a folder and all sub folders
wget -r -c -np https:\someplace.com\path\path\
down load a list of files. - create a text file with the url for each file say, filelist.txt
wget -c -i filelist.txt
What the options mean
-c if a download fails, restarting the wget command will continue downloading any partial file
-r recursive - download all the files in the specified directory and any sub directories.
-np no parent - a webpage might have links to other places higher than the directory you specified. This prevents wget from following those links.
Not specific to Python, but I can't live without:
Specific to Python on Windows... If you can't install some package, try with one from this site.
I noticed this too. I did some digging and apparently the author distributes a "source" tarball with each release. However, if you download the tarball, it's missing some obviously-GPL programs, such as bash.
IANAL, but this seems like a GPL violation, especially if these required modificatins to build. Not to say that this is malicious, it seems like an oversight.
Gow - The lightweight alternative to Cygwin
https://github.com/bmatzelle/gow/wiki
Gnu On Windows - a very handy set of tools to help bridge the gap between windows and gnu/unix systems. DD is included.
Linux is a kernel (same as Zircon, the microkernel that powers Fuchsia)
The "terminal" doesn't exist. You are talking about bash, zsh, etc. these are all Unix shells (they run in a variety of OSes, including Linux, Windows¹, MacOS and FreeBSD).
The GNU core utils are opened source, so it's only a matter of time (they are available even for Windows, natively²).
¹ Bash was ported natively, zsh runs through mingw quite well.
Your transition from the Dark Side progresses. I do this so often I've started installing GOW on every Windows box I can. In addition to a native 'ls' you get most of the Gnu tools as well.
Missing the point of the project..
> This project allows you to run bash scripts on Windows OSes without using Cygwin (http://www.cygwin.com/), MinGW/MSYS (http://www.mingw.org/wiki/MSYS) or any other large Unix emulation layer (https://github.com/bmatzelle/gow/wiki). It uses a tiny executable (636K) called busybox.exe instead in order to accomplish this task. BusyBox is known as "The Swiss Army Knife of Embedded Linux".
[SOLVED]
Ok, after hitting the head for a while, I managed to iron a script that does what I asked for almost perfectly. The only tolerable annoyance is that it leaves empty comicbook folders after zipping them, but I'll clear those with RED
So here is my final script, thanks WikiBox for your advice
This script browses Temp dir to level 2 and moves all files it finds to CBZ archives excluding path (-j), then deletes the JPGs (-m).
The result is
..\Publisher\Series\[emptycomic01...99]
..\Publisher\Series\comic01...99.cbz
#!/bin/bash find Temp -type d -not -empty -print0 | while IFS= read -r -d '' dir; do if find "$dir" -maxdepth 2 -type f | read f; then zip -jm "$dir"/../"$(basename "$dir").cbz" "$dir"/* fi done
To use this on Windows I had to install both GIT for Windows and GOW
There are several options:
https://stackoverflow.com/questions/7577615/parallel-wget-in-bash/11850469#11850469
Using Xargs to run multiple threads.
My windows version of xargs is from https://github.com/bmatzelle/gow/wiki
Microsoft Mouse Without Borders - I have a few laptops and two desktop workstations that I use, and this tool lets me copy + paste and use one mouse to control everything.
Display Fusion Pro - invaluable for multi monitor setups
mRemoteNG - huge fan of this RDP client.
Mintty/Cygwin - for when I need *nix functionality on Window. Also run other stuff like gnu utilities for win32, sysinternals suite, nirsoft suite, joetools suite, choclatey, powershell, 7-zip, robocopy.
Netsarang Xshell - my new favorite SSH/Telnet client
Notepad++ - keeps my todo list and everything in between. Sublime Text if I'm doing extended scripting or whatnot.
Solarized - not a tool, but a color scheme/theme in some applications. I use this everywhere I can. Reduces eye strain considerably.
Visio - I live in Visio. Essential for getting concepts across to the layman.
Hexchat - My favorite IRC client
Clover - tabbed windows explorer based on Chrome.
OneNote - The best software Microsoft ever created.
Greenshot - for screenshots
F.lux - great for reducing strain on your eyes.
VMWare Workstation/ESXi - I also live here, have various linux/windows VMs, some lab networks, etc. I actually have a few lab Windows domains running parallel for testing with everything virtual (routers/firewalls, storage, etc.) using Openfiler, m0n0wall, etc. Also have a few random VMs - CentOS, Ubuntu, Mac OSX. Been tooling around with oVirt and KVM on separate hardwares.
Veeam - best backup software if you have virtual (or if even if you don't.) Veeam One is also good stuff, I've been using it more and more for health reports and diagnoses.
RVTools - for grabbing raw data from my vCenter servers.
So you can go about 3 ways on this
1)use linux (or mac), if you want to learn it go ahead, I'm not a huge fan but linux mint is nice, with this you would use gcc or clang with text editor
2)use cygwin, or (to avoid bloat) a combination of conemu ( a sweet windows cli), gow (think linux commands built for windows), and windows based gcc (tdm is a great build of this), this is my personal choice, but hey to each their own
3)use the plethora of IDES out there and honestly it wont really matter a whole lot
honestly though python and c based languages are really portable and so long as your not making OS specific calls/functions you should be good to go either way
edit:damn i still cant figure out reddit item lists, sorry for the formatting
It's not built in like it should be but between tools like PowerShell, Cmder and Gow, the CLI experience has finally caught up where Linux and OS X have been.
For the filemanager, there is a solution, you can install cd & ls with gow
DEs are all awful. And i mean really, totally not usable at all.
edit:// i actually thought we are talking about windows. openbox is a wonderful DE, and Thunar / Dolphin totally useable and fast compared to the explorer.
> legacy shitfixes
My cmd.exe gets injected with ANSI support and other niceties thanks to clink.
Being using GOW since forever as a lightweight cygwin/msys (native) alternative.
And many more that I've since lost track since I've being dealing with Win/DOS since PC XTs with DOS 2.0.
Yeah... its shitfixes all around, ha ha!
The new Terminal Preview (now that finally runs in my PC) is a really nice change of pace.
Thank you for the detailed response. Learning a new command line is a little tricky at times.
Unfortunately, the command resolves the URL with "%20" as "0" for some reason leading to an error. Adding spaces instead and wrapping the whole thing in quotes gets around that. For some reason with the rest of the command provided I get an SSL error:
Resolving thetrove.net... 104.26.13.24, 104.26.12.24, (my ip), ... Connecting to thetrove.net|104.26.13.24|:443... connected. OpenSSL: error:14077410:SSL routines:SSL23_GET_SERVER_HELLO:sslv3 alert handshake failure Unable to establish SSL connection.
Which is new, it had connected and just gave me the weird files before. Putting the url in a separate file does the same thing.
I've also updated to the latest wget available, no change. Is there some difference I'm not seeing in the windows port of wget? Same issue with this port.
Is this an issue on my end at this point?
Set the PAGER
environment variable to a more sensible pager. It's documented here.
Looks like you can get less.exe
from https://github.com/bmatzelle/gow
My goto options are
wget -r -np -c https:\etc.
I sometimes use
I Read a list if url's from a file e.g.
wget -i filelist.txt
where filelist contains a list of file or directory paths.
If the site is HTTPS:\ you might need --no-check-certificate to get past self signed etc certificates.
so:
wget -r -np -c http://cdn.steelhousemedia.com/files/docs/Creative/fonts/All%20Fonts/
I'm using GOW's wget for windows (https://github.com/bmatzelle/gow/) and have it on my path so I can start a wget from the directory where I want the download to be dropped into.
After I removed duplicates I ended up with 11,351 files ~ 1.4GB
> From my understanding, cmd prior to powershell was pretty weak. Capable of doing basic commands, but nothing like what you could do with powershell, and nothing like what you could do with Bash.
Batch has the standard pipelines accessed in the familiar ways. for
lets you iterate the pipeline and other things. There are :labels
and call
and you can pass parameters so you've sorta got functions. set /A
does math. The major weakness is that the only kind of variable is environmental. You can fake an array since <code>[]</code> are valid characters for an environmental variable name but that comes loaded with caveats.
And again, Windows has shipped with powerful command-line tools since practically forever. netsh
was in Windows 2000, wmic
was in Windows 2003. If I had a dollar for every gnarly VBscript I've encountered that could have been more clearly and succinctly written using those two tools and a Batch script, I could buy myself a nice steak dinner.
I can't argue that Batch is better than Bash, but it's good enough to get things done and if you truly need something better there have always been win32 ports of popular scripting environments. Including Bash. In the late 1990s I worked with someone who wrote a ton of Perl to run on Windows systems, used a little trickery to make the Perl scripts valid Batch files that would bootstrap a Perl install if it wasn't already present.
Ultimately the Windows command-line has always been what you make of it.
If you have access to a bash shell + basic utils you could easily write a script to do this.
Basically you would want to list all files in the rom directory with full paths and spit that out to a file then grep that file and search for tags that match ones you don't want and rm based on the returned lines.
In one line (While in the fullset directory):
find . -type f | grep -E 'TAG|TAG' > romlist && rm $(<romlist)
As you can see you can match multiple tags at once if you want.
If you don't have access to bash + basic utils.. I'm no good with batch or vbscript..
Though you could easily get a basic setup with Cmder, Gow, or Git Bash.
GoW is one of the first things I install on a fresh workstation, so whenever I type ls
, curl
, etc into a shell without thinking that stuff would usually work close enough to how I expected... until PowerShell usurped CMD
as my main shell.
Probably I should modify my PS profile to remove the aliases that conflict with GoW and map most of the CMD
built-ins to CMD.exe /c
2 must have utilities for working on Windows (specifically, the CMD prompt)
Edit: CMDer looks pretty nice also
I develop on Windows, primarily Groovy but also some Node. I also have Ruby installed, but the only time I interact with it is when I'm working with my Octopress blog. I've never had an issue doing what I need to do with any of these languages (including packages, gems, etc.).
The biggest issue I've run into is a lack of tooling. There are some command line tools built for *nix systems that would be very convenient to have (http://gvmtool.net/, for example) that simply don't work on Windows. I can work around this and perform these actions manually, it can just be a hassle at times.
Ultimately, I don't think the convenience of having some of these tools available is worth the inconvenience of having to dual boot or work entirely in a VM, so I stick with Windows.
If you end up trying to stick with Windows, I recommend installing Gow and using PowerShell instead of the command prompt.