Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: MOVE/EXPORT FILES AT ONCE

  • To: mathgroup at smc.vnet.net
  • Subject: [mg100126] Re: MOVE/EXPORT FILES AT ONCE
  • From: Helen Read <hpr at together.net>
  • Date: Mon, 25 May 2009 06:19:06 -0400 (EDT)
  • References: <gv7qul$aqs$1@smc.vnet.net>
  • Reply-to: HPR <read at math.uvm.edu>

Alain Mazure wrote:
> Hi
> 
> How is it possible to move, at once, to e.g another directory , files 
> identified with e.g:
> 
> FileNames["*.dat"]
> 
> I.e, what is the equivalent of the classic cp *.dat and better the 
> equivalent of cp *.*  ?

Here's one way to do it.

files=FileNames["*.dat"];

move[x_] :=
  RenameFile[x,
   "C:\\Users\\HPR\\Documents\\math\\directory2" <> x];  (* needless to 
say, replace the path with your own *)

Map[move,files]

-- 
Helen Read
University of Vermont


  • Prev by Date: Re: Iterative solution difficulty
  • Next by Date: update notebook calculations on startup?
  • Previous by thread: Re: MOVE/EXPORT FILES AT ONCE
  • Next by thread: Re: MOVE/EXPORT FILES AT ONCE