Author Topic: Copy jpg to folder with vl-file-copy?  (Read 7278 times)

0 Members and 1 Guest are viewing this topic.

KewlToyZ

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #15 on: June 09, 2006, 02:40:24 PM »
how would I remove the quotes from the path stored in baseprefix?
that is the reason it reads the path as a command from the shell when I run it under

Code: [Select]
  (setq idx (vl-string-search "CADD" prefx))
  (setq baseprefix (strcat (substr prefx 1 (+ 5 idx)) "XREF\\"))
  (command "sh")
  (command copy X:\\logo.jpg baseprefix ))

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Copy jpg to folder with vl-file-copy?
« Reply #16 on: June 09, 2006, 02:56:06 PM »
Try this.
Code: [Select]
(if (findfile "X:\\logo.jpg")
 (if (findfile "X:\\A\\A0001\\Logos\\logo.jpg")
  (prompt "\n File already exists, cannot copy.")
  (vl-file-copy "X:\\logo.jpg" "X:\\A\\A0001\\Logos\\logo.jpg")
 )
 (prompt "\n Original file does not exist, cannot copy.")
)
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

T.Willey

  • Needs a day job
  • Posts: 5251
Re: Copy jpg to folder with vl-file-copy?
« Reply #17 on: June 09, 2006, 02:57:41 PM »
how would I remove the quotes from the path stored in baseprefix?
that is the reason it reads the path as a command from the shell when I run it under

Code: [Select]
  (setq idx (vl-string-search "CADD" prefx))
  (setq baseprefix (strcat (substr prefx 1 (+ 5 idx)) "XREF\\"))
  (command "sh")
  (command copy X:\\logo.jpg baseprefix ))
You would have to string all the string together with strcat.
Code: [Select]
(command (strcat "copy x:\\logo.jpg" baseprefix))

</guess about shell command>
Tim

I don't want to ' end-up ', I want to ' become '. - Me

Please think about donating if this post helped you.

Andrea

  • Water Moccasin
  • Posts: 2372
Re: Copy jpg to folder with vl-file-copy?
« Reply #18 on: June 09, 2006, 03:24:57 PM »
I have wrote this...
maybe could help..

Code: [Select]
(defun c:pgpbackup (/ pgpfile loginname)
(setq pgpfile (findfile "acad.pgp"))
(setq loginname (getvar "loginname"))
(if (findfile (strcat "x:/acad/pgp/" loginname ".pgp"))
    (vl-file-delete (strcat "x:/acad/pgp/" loginname ".pgp"))
)
(vl-file-copy pgpfile (strcat "x:/acad/pgp/" loginname ".pgp") T)
)code]
Keep smile...

Jeff_M

  • King Gator
  • Posts: 4096
  • C3D user & customizer
Re: Copy jpg to folder with vl-file-copy?
« Reply #19 on: June 09, 2006, 04:26:42 PM »
Here's my little contribution.....
Code: [Select]
(defun xcopy (source dest)
  (if (and (setq source (findfile source))
   (vl-file-directory-p (vl-filename-directory dest))
   )
    (progn
      (if (findfile dest)
(vl-file-delete dest)
)
      (vl-file-copy source dest)
      )
    )
  )

;;sample usage:
(xcopy "c:\\test.txt" "q:\\test.txt")
[\code]

KewlToyZ

  • Guest
Re: Copy jpg to folder with vl-file-copy?
« Reply #20 on: June 09, 2006, 04:41:46 PM »
I was taking some time to tell myself how much of an idiot I was.... :lol:
Forgot to include the filename with the path with vl-file-copy :|

Code: [Select]
(if (findfile "J:\\logo.jpg")
  (if (findfile (strcat baseprefix"logo.jpg"))
  (prompt "\n File already exists, cannot copy.")
  (vl-file-copy "J:\\logo.jpg" (strcat baseprefix"logo.jpg"))
  )
  (prompt "\n Original file does not exist, cannot copy.")
  )

Worked perfectly TWiley.
Great addition Jeff M
Nice feature there Andrea!