Statalist


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: Renaming File Names


From   "Friedrich Huebler" <[email protected]>
To   [email protected]
Subject   Re: st: Renaming File Names
Date   Tue, 6 May 2008 15:45:55 -0400

Raphael,

I assume you want to keep the extension.

local files: dir . files "*.csv"
foreach f of local files {
  local fnew = substr("`f'",1,4)
  shell ren "`f'" "`fnew'.csv"
}

Friedrich

On Tue, May 6, 2008 at 3:07 PM, Raphael Fraser <[email protected]> wrote:
> Is it possible to rename the file names below using the first four
>  characters in the file name in Stata?
>
>  018b_crp_13april08.0101.csv
>  020b_crp_26apr08.0101.csv
>  027b_crp_05april08.0101.csv
>  032bb_crp_06april08.0101.csv
>
>  Raphael
*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index