[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

file.length

Posted on 2006-05-03
3
Medium Priority
?
198 Views
Last Modified: 2010-04-23
How can I fix this see below. If the file is exactly 180kb, delete it.



For Each myfileInfo In myDir1.GetFiles("*.jpg")

ix += 1

If myfileInfo.Length <= 10 * 1024 Then

myfileInfo.MoveTo("F:\MailBox\temp\" & "ThisFileIsLessthanTenKb - " & _

DateTime.Now.ToString("yyyyMMddHHmmss") & "." & ix & ".jpg")

ElseIf myfileInfo.Length = 10 * 180000 Then              ------------- this line -------------------------

myfileInfo.Delete()





End If

jpgCount = myDir1.GetFiles("*.jpg").Length

Me.Label23.Text = jpgCount.ToString
0
Comment
Question by:VBdotnet2005
  • 2
3 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 16597819
ElseIf myfileInfo.Length = 1024 * 180 Then  
0
 
LVL 143

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 16597828
ie 180KB meaning exactly 180 * 1024 bytes.

if you means anything from 180KB + 0bytes up to 180KB + 1023 bytes, the condition would be different of course...
0
 

Author Comment

by:VBdotnet2005
ID: 16598174

Sorry, it does not move. What could it be. It is an image file.

For Each myfileInfo In myDir1.GetFiles("*.jpg")

ix += 1

If myfileInfo.Length <= 10 * 1024 Then

myfileInfo.MoveTo("F:\MailBox\temp\" & "ThisFileIsLessthanTenKb - " & _

DateTime.Now.ToString("yyyyMMddHHmmss") & "." & ix & ".jpg")

ElseIf myfileInfo.Length = 180 * 1024

myfileInfo.Delete()





End If

jpgCount = myDir1.GetFiles("*.jpg").Length

Me.Label23.Text = jpgCount.ToString
0

Featured Post

Prep for the ITIL® Foundation Certification Exam

December’s Course of the Month is now available! Enroll to learn ITIL® Foundation best practices for delivering IT services effectively and efficiently.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create and use a custom WaterMark textbox class.  The custom WaterMark textbox class allows you to set the WaterMark Background Color and WaterMark text at design time.   IMAGE OF WATERMARKS STEPS Create VB …
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
This lesson discusses how to use a Mainform + Subforms in Microsoft Access to find and enter data for payments on orders. The sample data comes from a custom shop that builds and sells movable storage structures that are delivered to your property. …
Suggested Courses

873 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question