all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* recursively move types of files
@ 2008-05-15  0:22 Charles L. Snyder
  2008-05-15  7:04 ` Kevin Rodgers
                   ` (3 more replies)
  0 siblings, 4 replies; 6+ messages in thread
From: Charles L. Snyder @ 2008-05-15  0:22 UTC (permalink / raw)
  To: help-gnu-emacs

Hi

I have 2 separate but file management - related questions (emacs
22.2.1, mac leopard system):

1. I want to move all .pdb files from a folder (and all its
subfolders):

/Users/cls/ebooks

to another folder:
 /Users/cls/pdb_files

I can find all the files with Alt-x find-dired RET ~/ebooks RET -name
"*.pdb" RET
but how do I mark and move the files within emacs?

2. I have a huge number of files named like this
"Report_work_01232008_blah.pdf", and I want to replace all the "_"
with " "
ie., "Report work 01232008 blah.pdf"
Some files have one underscore, some have many more.

When I Crtl-x d to the folder, and mark all files containing (% g RET
_ ) an underscore, there are several problems:

- it doesn't search and mark files in the the subdirectories / nested
folders

- only the first underscored in the filename is changed, not all of
them  (how do I fix the regex for "_")

- I sometimes get a 'maximum buffer size exceeded'.

Thanks in advance

cls


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: recursively move types of files
  2008-05-15  0:22 recursively move types of files Charles L. Snyder
@ 2008-05-15  7:04 ` Kevin Rodgers
  2008-05-15 12:06 ` Peter Dyballa
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 6+ messages in thread
From: Kevin Rodgers @ 2008-05-15  7:04 UTC (permalink / raw)
  To: help-gnu-emacs

Charles L. Snyder wrote:
> 1. I want to move all .pdb files from a folder (and all its
> subfolders):
> 
> /Users/cls/ebooks
> 
> to another folder:
>  /Users/cls/pdb_files
> 
> I can find all the files with Alt-x find-dired RET ~/ebooks RET -name
> "*.pdb" RET
> but how do I mark and move the files within emacs?

Since originally none of the files are marked, dired-toggle-marks (bound
to `t') marks them all.  Then dired-do-rename (bound to `R') will move
them.

-- 
Kevin Rodgers
Denver, Colorado, USA





^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: recursively move types of files
  2008-05-15  0:22 recursively move types of files Charles L. Snyder
  2008-05-15  7:04 ` Kevin Rodgers
@ 2008-05-15 12:06 ` Peter Dyballa
       [not found] ` <mailman.11620.1210853177.18990.help-gnu-emacs@gnu.org>
  2008-05-15 13:21 ` Ken Goldman
  3 siblings, 0 replies; 6+ messages in thread
From: Peter Dyballa @ 2008-05-15 12:06 UTC (permalink / raw)
  To: Charles L. Snyder; +Cc: help-gnu-emacs


Am 15.05.2008 um 02:22 schrieb Charles L. Snyder:

> 2. I have a huge number of files named like this
> "Report_work_01232008_blah.pdf", and I want to replace all the "_"
> with " "


It's probably better to do it outside dired-mode, in a *shell* buffer:

	find <directory> -type f -exec trans.sh {} \;

maybe added with a -name <pattern> option and a shell script trans.sh  
like:

	#!/bin/sh
	dir="`dirname $1`"
	fil="`basename $1`"
	new="`echo "$fil" | tr _ ' '`"
	mv "$1" "$dir/$new"

or in bash:

	#!/bin/bash
	dir=$(dirname $1)
	fil=$(basename $1)
	new=$(echo "$fil" | tr _ ' ')
	mv "$1" "$dir/$new"


--
Greetings

   Pete

When in doubt, use brute force.
				– Ken Thompson







^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: recursively move types of files
       [not found] ` <mailman.11620.1210853177.18990.help-gnu-emacs@gnu.org>
@ 2008-05-15 12:15   ` Sven Joachim
  2008-05-15 13:24     ` Thierry Volpiatto
  0 siblings, 1 reply; 6+ messages in thread
From: Sven Joachim @ 2008-05-15 12:15 UTC (permalink / raw)
  To: help-gnu-emacs

On 2008-05-15 14:06 +0200, Peter Dyballa wrote:

> Am 15.05.2008 um 02:22 schrieb Charles L. Snyder:
>
>> 2. I have a huge number of files named like this
>> "Report_work_01232008_blah.pdf", and I want to replace all the "_"
>> with " "
>
>
> It's probably better to do it outside dired-mode, in a *shell* buffer:

Why that?  I'd switch to wdired-mode and do a query-replace followed by
C-c C-c.  No need to write a shell script.

Sven


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: recursively move types of files
  2008-05-15  0:22 recursively move types of files Charles L. Snyder
                   ` (2 preceding siblings ...)
       [not found] ` <mailman.11620.1210853177.18990.help-gnu-emacs@gnu.org>
@ 2008-05-15 13:21 ` Ken Goldman
  3 siblings, 0 replies; 6+ messages in thread
From: Ken Goldman @ 2008-05-15 13:21 UTC (permalink / raw)
  To: help-gnu-emacs

wdired-mode

Charles L. Snyder wrote:
> 
> 2. I have a huge number of files named like this
> "Report_work_01232008_blah.pdf", and I want to replace all the "_"
> with " "
> ie., "Report work 01232008 blah.pdf"
> Some files have one underscore, some have many more.


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: recursively move types of files
  2008-05-15 12:15   ` Sven Joachim
@ 2008-05-15 13:24     ` Thierry Volpiatto
  0 siblings, 0 replies; 6+ messages in thread
From: Thierry Volpiatto @ 2008-05-15 13:24 UTC (permalink / raw)
  To: Sven Joachim; +Cc: help-gnu-emacs

Sven Joachim <svenjoac@gmx.de> writes:

> On 2008-05-15 14:06 +0200, Peter Dyballa wrote:
>
>> Am 15.05.2008 um 02:22 schrieb Charles L. Snyder:
>>
>>> 2. I have a huge number of files named like this
>>> "Report_work_01232008_blah.pdf", and I want to replace all the "_"
>>> with " "
>>
>>
>> It's probably better to do it outside dired-mode, in a *shell* buffer:
>
> Why that?  I'd switch to wdired-mode and do a query-replace followed by
> C-c C-c.  No need to write a shell script.
>
> Sven
>
To serial rename files you can also use:
http://www.emacswiki.org/cgi-bin/wiki/SerialRename
(Not sure it will work with space, it's a long time i don't check this code)
Tought it's a bad idea to name files ala losedows with spaces.
-- 
A + Thierry
Pub key: http://pgp.mit.edu




^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2008-05-15 13:24 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-15  0:22 recursively move types of files Charles L. Snyder
2008-05-15  7:04 ` Kevin Rodgers
2008-05-15 12:06 ` Peter Dyballa
     [not found] ` <mailman.11620.1210853177.18990.help-gnu-emacs@gnu.org>
2008-05-15 12:15   ` Sven Joachim
2008-05-15 13:24     ` Thierry Volpiatto
2008-05-15 13:21 ` Ken Goldman

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.