Jump to content

Klasör Kopyalamak


Skorpion
 Share

Recommended Posts

ben Autoplay media studio ile klasör kopyalamayi istiyorum ama bir türlü beceremedim
Programlar klasörünü D ye veya belegelerime kopyalamak istiyorum
asagidaki kodlari denedim ama olmadi
yardimci olabilirmisiniz bana
[CODE]
File.Install("AutoPlay\\Docs\\Programlar", "D:\\", false, false, nil, nil);

File.Copy("AutoPlay\\Docs\\Programlar", "D:\\", true, true, false, true, nil);[/CODE]
Link to comment
Share on other sites

[font=tahoma,geneva,sans-serif]Ams ile klasör kopyalayabileceğin bir kod yok. Bir ara bu işlem için bir fonksiyon yazmıştım ama her nedense yavaş kopyalıyordu. Vakit bulup düzgün birşeyler yazabilirsem forumda paylaşırım.[/font]

Link to comment
Share on other sites

Çok güzel bir fonksiyon yazmışlar bu iş için:

Global Functions:
 

function CopyFolder(sSource, sDestination)
local m_sFolder;
local m_FoundFolder;
local error;

--Find all the folders and sub-Folders
--results are stored in the table m_tblFolders
m_tblFolders = Folder.Find(sSource, "*", true, nil);

--if our destination folder does not have the
--backslash as the last character, add it
if String.Right(sDestination, 1) ~= "\\" then
sDestination = sDestination .. "\\";
end

--m_tblFolders will be nil if there are no folders
if m_tblFolders ~= nil then
--enumerate through the found folders
for n, m_FoundFolder in pairs(m_tblFolders) do
--replace the source's path with the destination's path
m_sFolder = String.Replace(m_FoundFolder, sSource, sDestination, false);
--create the folder
Folder.Create(m_sFolder);
error = Application.GetLastError();
if (error ~= 0) then
--set n to value to exit FOR loop
n = Table.Count(m_tblFolders)
end
end
end

--if no errors occurred, copy the files
if (error == 0) then
--show the status dialog
StatusDlg.Show(MB_ICONNONE, false);
--copy all files from the source folder, with recurse.
File.Copy(sSource .. "\\*.*", sDestination, true, true, false, true, nil);
--hide the status dialog
StatusDlg.Hide();
error = Application.GetLastError();
end

--clean up
m_tblFolders = nil;
return error;
end
Kopyalama buttonu:

sKaynak = Dialog.FolderBrowse("klasor secin", _DesktopFolder)
if sKaynak ~= "CANCEL" then
sHedef = "C:\\a"
if CopyFolder(sKaynak, sHedef) == 0 then
result = Dialog.Message("Folder Copy", "The folder has been successfully copied!", MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);
else
result = Dialog.Message("Folder Copy", "There was an error copying the folder.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1);
end
end
Link to comment
Share on other sites

@Kintaro benim istegim dosya secmeden belirlemis oldugum Docs klasöründe bulunan bikac klasörü
kopyala tusuna tikladigimda belirlenmis yere kopyalamasi

bir apz buldum bunda kopyalama yapiyor fakat ayni sizin vermis oldugunuz gibi secmeli
bunun kodlarini düzenliyebilirmisiniz acaba secmeli degilde scripte yolu gösterip
kopyalaya tikladigimda kopyalamayi gerceklestirsin

bu apzda docs klasöründe FldrActn.dll var bu dll kopyalamayi sagliyor sanirim




[CODE]

select = Dialog.FolderBrowse("Please select a folder:", _SourceDrive);
destination = Dialog.FolderBrowse("Please select a folder:", _SourceDrive.."\\destfolder");
result = DLL.CallFunction("AutoPlay\\Docs\\FldrActn.dll", "CopyFolder", "\"" .. select .. "\"" .. ",\"" .. destination .. "\",1,1", DLL_RETURN_TYPE_STRING, DLL_CALL_STDCALL)
Dialog.Message("Notice", result, MB_OK, MB_ICONINFORMATION, MB_DEFBUTTON1);



[/CODE]




[b] [/b]

Link to comment
Share on other sites

benim verdiğimde de, senin verdiğinde de bir değişkeni değiştirip yapabilirsin.

benim kodda ki

sKaynak = "C:\\abc"
sHedef = "D:\\def"

şeklinde kaynak ve hedef klasorlerini belirtebilirsin.

Senin verdiğin kodda da;

select = "C:\\abc"
destination = "D:\def"

şeklinde kaynak ve hedef klasorlerini belirtebilirsin.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...