Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
Go Back   Dev Hardware ForumsSOFTWAREProgramming
ASP Free and Iron Speed Designer are giving away $5,500+ in FREE licenses. Iron Speed's RAD CASE toolset can save up to 80% of your coding time. One free license per week, one perpetual license per month!

Download and Activate to enter!
Open source technologies have proven to be extremely advantageous to businesses.
This adaptive and highly efficient kind of software is central to the infrastructure of most companies. Since the world of open source technology is constantly changing,
IT professionals need a resource to give them up-to-the-minute information about these enterprise level and open source technologies. Dev Shed is that resource .
The ASP Free website provides in-depth information on the latest developer tools available from Microsoft. Our cadre of writers, highly experienced industry experts, reveals the best ways to use established technologies as well as new and emerging technologies. Our coverage of Microsoft's development and administration technologies is among the most respected in the IT industry today. .

Download to Enter | Contest Rules

Tutorials | Forums

Tutorials | Forums

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Hardware Forums Sponsor:
  Trader Rating: 0 · #1  
Old October 7th, 2009, 02:35 PM
ronsoto ronsoto is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 9 ronsoto User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 37 sec
Reputation Power: 0
Chk for 'file'

hi,

when writing a batch.bat file:

i want to check a folder/directory for individual files. currently there are two sub-folders that reside in the folder i want to monitor.

this said is there a way to distinguish between 'files' and directories when looking for files that are placed into this folder?

thanks,

ron

Reply With Quote
  Trader Rating: 2 · #2  
Old October 7th, 2009, 03:21 PM
Dngrsone's Avatar
Dngrsone Dngrsone is offline
Grumpy old Moderator
Click here for more information.
 
Join Date: May 2004
Location: Centrally located in the middle of nowhere, CA
Posts: 9,222 Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)  Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 10 Months 3 Weeks 2 Days 3 h 37 m 41 sec
Reputation Power: 17246
Which operating system?
__________________
Ask Questions the Smart Way


"In front of a monitor is a dangerous place from which to view the world." --Terri Wells

Enable BSOD: Control Panel/Systems, Advanced Tab, hit the Settings button under Startup and Recovery, and under the System Failure area, uncheck the Automatically Restart checkbox.

Reply With Quote
  Trader Rating: 0 · #3  
Old October 7th, 2009, 03:25 PM
ronsoto ronsoto is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 9 ronsoto User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 37 sec
Reputation Power: 0
sorry for the confusion..

xp.

ron-

Reply With Quote
  Trader Rating: 2 · #4  
Old October 7th, 2009, 03:36 PM
Dngrsone's Avatar
Dngrsone Dngrsone is offline
Grumpy old Moderator
Click here for more information.
 
Join Date: May 2004
Location: Centrally located in the middle of nowhere, CA
Posts: 9,222 Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)Dngrsone User rank is General 244th Grade (Above 100000 Reputation Level)  Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2Folding Points: 523166 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 10 Months 3 Weeks 2 Days 3 h 37 m 41 sec
Reputation Power: 17246
Well, are teh files of a particular extension, ie .txt?

For that matter, you could search the name of the file/directory and see if there is a . since in Windows conventions directories generally don't have suffixes.

Reply With Quote
  Trader Rating: 0 · #5  
Old October 7th, 2009, 06:34 PM
ronsoto ronsoto is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 9 ronsoto User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 37 sec
Reputation Power: 0
hi..

this is what i came up with..::

@echo off

dir "\\machine\dir\sub-dir\*.xml"
if %errorlevel%=0

then

move "\\machine\dir\*.xml \\Www\rossfiles\*.xml"

else

end

---


but i'm getting an error at the 'errorlevel' portion.

ron-

Reply With Quote
  Trader Rating: 0 · #6  
Old October 7th, 2009, 07:19 PM
ronsoto ronsoto is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 9 ronsoto User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 37 sec
Reputation Power: 0
i also tried

IF ERRORLEVEL 1
THEN ......
---

IF %ERRORLEVEL% = 1

THEN...
---

basically i just want to move files from one folder to another if an *.xml file has been placed there by accident. i can do it manually, but was thinking that a batch file would be better.

thanks,

ron-

Reply With Quote
  Trader Rating: 0 · #7  
Old October 8th, 2009, 07:08 AM
archnaid's Avatar
archnaid archnaid is offline
Moderator
Dev Hardware Specialist (4000 - 4499 posts)
 
Join Date: Feb 2004
Posts: 4,112 archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)archnaid User rank is General 92nd Grade (Above 100000 Reputation Level)  Folding Points: 737264 Folding Title: Super Ultimate Folder - Level 2Folding Points: 737264 Folding Title: Super Ultimate Folder - Level 2Folding Points: 737264 Folding Title: Super Ultimate Folder - Level 2Folding Points: 737264 Folding Title: Super Ultimate Folder - Level 2Folding Points: 737264 Folding Title: Super Ultimate Folder - Level 2Folding Points: 737264 Folding Title: Super Ultimate Folder - Level 2Folding Points: 737264 Folding Title: Super Ultimate Folder - Level 2
Time spent in forums: 1 Month 1 Week 6 Days 17 h 51 m 19 sec
Reputation Power: 7080
Here's some things to play with, this runs on my computer:
Code:
@ECHO OFF
dir "C:\"
IF %ERRORLEVEL% NEQ 0 SET ERRORLEV=%ERRORLEVEL%
IF ERRORLEVEL 0 SET ERRORLEV=0
ECHO ERRORLEVEL = %ERRORLEV%


A couple notes on syntax.

As far as I can tell, in batch there is no if/then/else structure. IF <test> DO <commands> is how it flows, you'd have to write two IF statements to cover two mutually exclusive options, as I did above.

Second, 'end' will throw an error. You want to use 'EXIT' and there are some options you can use with that. By default EXIT ends the batch script and ends cmd.exe. You should be able to get it to just end the batch and leave cmd.exe running, and to set exit codes.

Third, and this is due to my own inexperience with batch - I'm not sure that MOVE is a valid command.

Reply With Quote
  Trader Rating: 0 · #8  
Old October 8th, 2009, 02:54 PM
ronsoto ronsoto is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 9 ronsoto User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 37 sec
Reputation Power: 0
gawd.. there i go thinking again!! <grinning>

i used to be in a Unix envrionment and hence the 'end' and 'other' syntax that's incorrect. sorry 'bout the confusion (if there was any)

let me work on what you've given me and i'll see what i can come up with..

i'll report back.

ron-

Reply With Quote
  Trader Rating: 0 · #9  
Old October 10th, 2009, 06:55 PM
mphill's Avatar
mphill mphill is offline
untitled
Click here for more information
 
Join Date: Oct 2005
Location: Zagreb
Posts: 3,936 mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)mphill User rank is General 133rd Grade (Above 100000 Reputation Level)  Folding Points: 14729 Folding Title: Novice Folder
Time spent in forums: 3 Months 3 Weeks 4 Days 23 h 23 m 18 sec
Reputation Power: 9876
Send a message via ICQ to mphill
Facebook
Quote:
Originally Posted by Dngrsone
Well, are teh files of a particular extension, ie .txt?

For that matter, you could search the name of the file/directory and see if there is a . since in Windows conventions directories generally don't have suffixes.

Nooooooooooooooooooooooo !!!


This is very bad programming.
__________________
Click Here ->    

Reply With Quote
  Trader Rating: 0 · #10  
Old October 12th, 2009, 03:52 PM
ronsoto ronsoto is offline
n00b DevH'er
Dev Hardware Newbie (0 - 499 posts)
 
Join Date: Sep 2009
Posts: 9 ronsoto User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 52 m 37 sec
Reputation Power: 0
hi.. i ended up with (which works)

if \\machine\dir\sub-dir\*.xml
commands


.......


thanks for all the help guys!

ron-

Reply With Quote
Reply

Viewing: Dev Hardware ForumsSOFTWAREProgramming > Chk for 'file'


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
     
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.

© 2003-2012 by Developer Shed. All rights reserved. DS Cluster 1 - Follow our Sitemap
LOADING INFUSIONSOFTLOADING INFUSIONSOFT 1debug:overlay status: OFF
overlay not displayed overlay cookie defined: TI_CAMPAIGN_1012_D OVERLAY COOKIE set:
status off