473,386 Members | 1,943 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Change folders name using coldfusion scripts like cffile, read etc

I would like to change all my sub folders name within a main folder, how do I do that???
like: -
app1
amm1
ann1

to
app1pp
amm1pp
ann1pp

using cffile / read /write etc

(I am new to coldfusion scrtpts)
Sep 30 '08 #1
5 4086
acoder
16,027 Expert Mod 8TB
The first thing to do is check the Coldfusion documentation for cffile on the Adobe website. The action should be set to "rename".

If you get stuck, post back with the code that you tried.
Sep 30 '08 #2
rename is to change name of file??? or name of folder

mainfolder/
app1
amm1
ann1

and inside this main folder there are also files
show.cfm
view.cfm

1. Folder name -- How do I read the folder name without the file name in a directory??

Current, I am using <cfdirectory directory="#ExpandPath( '..\..\..\..\0addResume\#aa1_addresumefirst#\' )#" action="list" name="currentDir"> to read the directory. But if I want to read the folder name with showing the file name

=====I would like to read all folder name only

Thanks
Oct 1 '08 #3
acoder
16,027 Expert Mod 8TB
Sorry, I thought you wanted to rename files (I guess I didn't read carefully).

Use <cfdirectory action="rename" ...> to rename a directory. If you don't know all the names of the directories, and you want to list only directories, loop over the query returned by cfdirectory and check the type attribute. If it's "DIR", it's a directory.
Oct 1 '08 #4
I have done it as follows without the cfdirectory code as

==============================

Expand|Select|Wrap|Line Numbers
  1. <cfdirectory directory="#ExpandPath( '..\..\..\..\0addResume\from word to html2\' )#" action="list" name="rs">
  2.  
  3.   <cfloop query="rs">
  4.  
  5. <cfoutput> 
  6. <cfif rs.type IS "dir">
  7. #rs.name#
  8. <cffile action="rename" source="#dd##rs.name#" destination="#dd##rs.name#_pp">
  9. </cfif>
  10. <p>
  11. </cfoutput>
  12.  
============== it is running fine ======

If I want to use cfdirectory, how do I do it??

Expand|Select|Wrap|Line Numbers
  1. <cffile action="rename" source="#dd##rs.name#" destination="#dd##rs.name#_pp" attributes="normal">
  2. or
  3. <cfdirectory action="rename" source="#dd##rs.name#" destination="#dd##rs.name#_xxx" attributes="directory">
  4.  
it gives an error:-
Attribute validation error for the CFDIRECTORY tag.
When the value of the ACTION attribute is RENAME, the tag requires the attribute(s): DIRECTORY,NEWDIRECTORY.
Oct 2 '08 #5
acoder
16,027 Expert Mod 8TB
Instead of source and destination attributes, you need to use directory and newDirectory when using cfdirectory.

PS. please use code tags when posting code. Thanks.
Oct 2 '08 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Phil Powell | last post by:
I have CF MX 6.1 with JRun running in the background. I want to be able to write JSP scripts as well as ColdFusion, however, I don't know how to do this (I can write JSP, but how to do it within...
2
by: indyjason79 | last post by:
I'm in the process of creating a huge Global Website for a large company. I was wondering how I could separate the code from the text and I'm starting to look into XML for this. I was thinking I...
3
by: Trond Hoiberg | last post by:
I have an XML file with some data: <Directlist> <Directory> <ID>1</ID> <name>DirectoryRed</name> </Directory> <Directory> <ID>2</ID> <name>DirectoryBlue</name>
5
by: manokumar | last post by:
hiye, i notice that some if not all of my folders in winxp pro. are set as read only and its giving me some problem with development. so as the natural thing, i unchecked the read only option and...
1
by: Robert Scheer | last post by:
Hi. Is there any article that talks about the purpose of each of the Frontpage extensions folders (_vti_cnf, _vti_pvt, _vti_script, and _vti_txt)? When I create a new ASP.NET application, these...
3
by: sva | last post by:
Using C# for an application in which I am working on, I need to display the available shared folders on the computer that's running the application. The shared folder paths need to be in UNC format...
12
by: Krustov | last post by:
Using the standard php functions found on most web servers - how do i zip selected folders and have the zip file emailed to myself . Not as a cron job or anything automated - it will be a option...
3
by: jerryyang_la1 | last post by:
I'm looking for a script / scripts that will allow me to control files that users can download. I would like to create 'General Folder' that any registered user can download from and private...
1
by: Arielle | last post by:
The Problem: Currently working on a way to catalog a large flux of files into a database. The files are for the most part uniform but some of the flags in the database fields vary depending on the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.