Thread: Reading only filenames

  1. #1
    Registered User
    Join Date
    Jan 2005
    Posts
    3

    Reading only filenames

    Hey. i'm working with JPG's here and they are constantly being edited yada yada yada... what i need to know is a way to read the filename so i can detect its format, yada yada, and move the file where desired. program to run in the background.
    anyway, thanks in adavance for any help.
    -c

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Which Operating system and compiler?

    Are you wanting to get a directory listing at periodic intervals for example?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jan 2005
    Posts
    3
    i use an old borland turbo IDE compiler+debugger. and i'm looking at anything that runs with dos 7 (win98) and up. command line or otherwise. anything to get the job done.
    to have it periodically do whats needed is ok. but what would be nice is to have it idle and wait for a file to be loaded.
    then work its magic.

    :edit:
    what is needed of this program is to read the file name, determine its format, then sort into folders by certain points in the file name. ex. file name is WWWWXXXXXYYYZZa.jpg or WWWWXXXXXZZa.jpg i need to sort the files by 'WWWW'
    then by 'ZZ'
    Last edited by claytonross; 01-11-2005 at 12:58 PM.

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Get a better compiler then - that old crusty thing is no good for writing modern programs capable of taking advantage of all that your OS has to offer.

    Dev-C++ is a good bet.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  5. #5
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    While you're downloading: FAQ: Accessing a directory and all the files within it

    You could also do what you want with a batch file.

    gg

  6. #6
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Or if you want to get advanced, then use change notifications

    Or you could use the windows scheduler to run your program every 5 minutes say, and it just does a one-time scan of the directory and does whatever work is necessary.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  7. #7
    Registered User
    Join Date
    Jan 2005
    Posts
    3
    how about this...? how do i get a filename stored into a string so i can write the program to determin that file 0034xxxxxyyy.jpg needs to go into folder 34 and move it?

  8. #8
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,660
    Well the FAQ quoted by codeplug would show you that.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 7
    Last Post: 02-02-2009, 07:27 AM
  2. Reading in filenames
    By willc0de4food in forum C Programming
    Replies: 9
    Last Post: 08-23-2005, 08:55 AM
  3. Reading filenames and creating folders
    By Bitphire in forum C++ Programming
    Replies: 2
    Last Post: 03-03-2005, 01:38 PM
  4. Help Reading Data from Specific Filenames
    By RguyK128 in forum C Programming
    Replies: 4
    Last Post: 02-18-2005, 06:26 AM
  5. reading filenames
    By Paul in forum C++ Programming
    Replies: 1
    Last Post: 07-01-2003, 10:02 AM