Liberty BASIC Community Forum
« Need some files help »

Welcome Guest. Please Login or Register.
Nov 24th, 2017, 10:50am


Rules|Home|Help|Search|Recent Posts|Notification


« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: Need some files help  (Read 311 times)
milfredo
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 113
xx Need some files help
« Thread started on: Jul 13th, 2017, 01:20am »

If I want to copy a file from one folder and place the copy in another folder can someone tell me how to accomplish that? I know how to open and copy a file, but I am stuck there. I don't know how to place the copy in another folder.

Thanks,
Milfredo
User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5567
xx Re: Need some files help
« Reply #1 on: Jul 13th, 2017, 01:39am »

Just name the new path in the file name c:\olddirectory\filename.ext becomes c:\newdirectory\newfilename.ext when you open or name the file. Be sure the new directory exits. Mkdir helps here.
User IP Logged

G. Rahman
Guru
ImageImageImageImageImage


member is offline

Avatar




Homepage PM

Gender: Male
Posts: 1146
xx Re: Need some files help
« Reply #2 on: Jul 13th, 2017, 07:10am »

on Jul 13th, 2017, 01:39am, Rod wrote:
Just name the new path in the file name c:\olddirectory\filename.ext becomes c:\newdirectory\newfilename.ext when you open or name the file. Be sure the new directory exits. Mkdir helps here.


hmmmm ....
this will move the file from one place to the other.
What happens if the user only wants a copy to move?

Gordon
User IP Logged

Gordon Rahman

http://www.libertybasic.nl
BeeTrap
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 21
xx Re: Need some files help
« Reply #3 on: Jul 13th, 2017, 08:06am »

Go to Liberty BASIC Programmer's Encyclopedia and look for:
file.operations
That has "Copying, Moving, Deleting and Renaming Files" by alexbarfoot.
http://lbpe.wikispaces.com/file.operations
« Last Edit: Jul 13th, 2017, 08:24am by BeeTrap » User IP Logged

milfredo
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 113
xx Re: Need some files help
« Reply #4 on: Jul 13th, 2017, 12:20pm »

Thanks Bee..... I love this community. So much help here. And I love using the Language.

Thanks again guys,
Milfredo
User IP Logged

milfredo
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 113
xx Re: Need some files help
« Reply #5 on: Jul 13th, 2017, 1:16pm »

Bee,

I have gone through the encyclopedia info and see how to use hard coding for the filenames and path, but I don't see how to do things when the filename is in a variable.


User IP Logged

Rod
Global Moderator
ImageImageImageImageImage


member is offline

Avatar

Graphics = goosebumps!


PM

Gender: Male
Posts: 5567
xx Re: Need some files help
« Reply #6 on: Jul 13th, 2017, 2:18pm »

Perhaps if you post a line of code that shows what you are trying to do. What is the path and name of the original file, how are you trying to move/copy it, what is the new path/name you wish the file to have?
User IP Logged

BeeTrap
New Member
Image


member is offline

Avatar




PM

Gender: Male
Posts: 21
xx Re: Need some files help
« Reply #7 on: Jul 13th, 2017, 5:19pm »

Hello milfredo, Rod is MUCH more qualified to give you an answer than I. I have found that if you ask here, and give good clues/information, you shall receive. smiley
Curtis
User IP Logged

milfredo
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 113
xx Re: Need some files help
« Reply #8 on: Jul 13th, 2017, 5:37pm »

The user of my program will select a race file to use.

C:\2017\Q2_2017\apx0709.jcp would be a selection let's say. Then the program needs to copy that file and put it in

C:\handibatchdata\apx0709.jcp so the program can process the data and then delete the copy.

Hope this helps.

Milfredo
User IP Logged

milfredo
Full Member
ImageImageImage


member is offline

Avatar




PM

Gender: Male
Posts: 113
xx Re: Need some files help
« Reply #9 on: Jul 14th, 2017, 01:51am »

As usual, when I pay attention I answer my own questions...LOL Here's the code that works for me. fileName$ is derived at through the filedialog$

Racefolder$="C:\handibatchracedata"
RacefullFname$= Racefolder$ +"\" + trackname$


open fileName$ for input as #original
open RacefullFname$ for output as #copy
print #copy, input$(#original, lof(#original));
close #original
close #copy

Thanks guys for the help. I appreciate it.
Milfredo
User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

Rules|Home|Help|Search|Recent Posts|Notification

Donate $6.99 for 50,000 Ad-Free Pageviews!

| |

This forum powered for FREE by Conforums ©
Sign up for your own Free Message Board today!
Terms of Service | Privacy Policy | Conforums Support | Parental Controls