On Thu, Oct 20, 2011 at 8:08 AM, [email protected] <[email protected]> wrote: > Shell commands scare me a lot.
As both a Mac and a Linux user, I don't see why this should be so. Especially on Linux, the command line is really the way to go for a lot of things. On the Mac, Terminal.app is readily available for doing all kinds of cool things that often beat the GUI senseless. > I would prefer to avoid all those text based solutions, and more when > requiring more or less advanced Regular Expressions. > Out of my experience I know that even a tiny error there (a single > misplaced character) might bear to unforeseen and destructive results. > This, coupled with the fact that my required action here is to > "delete" files, is more than enough to make me quite scared. Backups. Backups. Backups. Both the PHP file managers seem like overkill just to delete a set of files with a very clear and well-known pattern. Developing a php script to do this should scare you more if you are doing it on your production site. For development and test, I have local copies of my wikis, and then when all is good, I upload the changes to production. This all assumes you have ssh access to your hosting location, which you may not. Before you delete pages, you may want to backup your wiki.d folder. See below for a way of doing that with rsync or wget. Continuing with the assumption you have ssh access, doing what you want is as simple as: $ ssh user@server 'cd path/to/pmwiki/wiki.d/Comments/; rm *,del-*' which will remove all the deleted pages from the Comments group. In the case where you don't have ssh access to the hosting site, I recomment a command line tool for ftp such as ncftp. You can then do: $ echo "rm *,del-*" | ncftp ftp://user:password@server/path/to/wiki.d/Comments/ from the command line. If showing your password in the command line scares you, you can simply run: $ ncftp ftp://user@server/path/to/wiki.d/Comments/ and it will prompt you for your password, and drop you into an interactive shell. From there, you can do something like: ncftp> ls *,del-* to see all the deleted pages, check to make sure there aren't any you don't actually want to delete. If you want to delete all of them, then you can issue the command: ncftp> rm *,del-* BACKUPS ------- If you do have ssh access, rsync is probably the best way to go here: $ rsync -av user@server:path/to/wiki.d/ wiki.d.backup/ rsync will prompt you for your password, and will start copying the files in wiki.d that have changed compared to the copies in wiki.d.backup if you have run it before. The first time it will copy everything. Subsequent times it will only copy changes (which speeds things up a lot). rsync has tons of options that make backing up and syncing directories a breeze. Again, if ssh isn't an option for you, you can retrieve wiki.d pages with wget to make a backup: $ mkdir wiki.d.backup $ cd $_ $ wget --user=user --ask-password --quiet 'ftp://server/path/to/wiki.d/*' This will retrieve everything in your wiki.d folder. wget tends to be pretty verbose, which is why I set the --quiet parameter. Of course, you should do the same thing with your uploads folder if you have any attachments. _______________________________________________ pmwiki-users mailing list [email protected] http://www.pmichaud.com/mailman/listinfo/pmwiki-users
